The basal ganglia including the subthalamic nucleus (STN) and substantia nigra pars reticulata (SNr) are involved in pain-related responses, but how they regulate pain processing remains unknown. Here, we identify a pathway, consisting of GABAergic neurons in the SNr (SNrGABA) and glutamatergic neurons in the STN (STNGlu) and the lateral parabrachial nucleus (LPBGlu), that modulates acute and persistent pain states in both male and female mice. The activity of STN neurons was enhanced in acute and persistent pain states. This enhancement was accompanied by hypoactivity in SNrGABA neurons and strengthening of the STN–LPB glutamatergic projection. Reversing the dysfunction in the SNrGABA-STNGlu-LPBGlu pathway attenuated activity of LPBGlu neurons and mitigated pain-like behaviors. Therefore, the SNrGABA-STNGlu-LPBGlu pathway regulates pathological pain and is a potential target for pain management.