Knowledge about risks for overuse of psychoactive analgesics in patients having primary surgery for carpal tunnel syndrome (CTS) or ulnar nerve entrapment (UNE), or both, is limited. We investigated if patients with those nerve entrapment disorders have a higher risk of overuse of psychoactive analgesics (i.e., opioids and gabapentinoid drugs) before, after, and both before and after surgery than observed in the general population after accounting for demographical and socioeconomic factors. Using a large record linkage database, we analysed 5,966,444 individuals (25–80 years), residing in Sweden December 31st, 2010–2014, of which 31,380 underwent surgery 2011–2013 for CTS, UNE, or both, applying logistic regression to estimate relative risk (RR) and 95% confidence interval (CI). Overall, overuse of the psychoactive analgesics was low in the general population. Compared to those individuals, unadjusted RR (95% CI) of overuse ranged in patients between 2.77 (2.57–3.00) with CTS after surgery and 6.21 (4.27–9.02) with both UNE and CTS after surgery. These risks were only slightly reduced after adjustment for demographical and socioeconomic factors. Patients undergoing surgery for CTS, UNE, or both, have a high risk of overuse of psychoactive analgesics before, after, and both before and after surgery.