Due to the prevalence of chronic pain worldwide, there is an urgent need to improve pain management strategies. While opioid drugs have long been used to treat chronic pain, their use is severely limited by adverse effects and abuse liability. Neurostimulation techniques have emerged as a promising option for chronic pain that is refractory to other treatments. While different neurostimulation strategies have been applied to many neural structures implicated in pain processing, there is variability in efficacy between patients, underscoring the need to optimize neurostimulation techniques for use in pain management. This optimization requires a deeper understanding of the mechanisms underlying neurostimulation-induced pain relief. Here, we discuss the most commonly used neurostimulation techniques for treating chronic pain. We present evidence that neurostimulation-induced analgesia is in part driven by the release of endogenous opioids and that this endogenous opioid release is a common endpoint between different methods of neurostimulation. Finally, we introduce technological and clinical innovations that are being explored to optimize neurostimulation techniques for the treatment of pain, including multidisciplinary efforts between neuroscience research and clinical treatment that may refine the efficacy of neurostimulation based on its underlying mechanisms.