Chronic use of opioid analgesics can cause analgesic tolerance and opioid-induced hyperalgesia (OIH), contributing to dose escalation in patients. Corder et al. here provide evidence that, in mice, these unwanted effects, and the underlying altered circuit plasticity, are mediated by μ opioid receptors (MORs) expressed by primary nociceptors. Targeted genetic deletion of peripheral MORs or treatment with peripherally restricted MOR antagonists suppressed opioid tolerance and OIH without affecting analgesia, suggesting a possible strategy to improve pain management in patients.