Chronic pain is a hallmark of functional disorders, inflammatory diseases and cancer of the digestive system. The mechanisms that initiate and sustain chronic pain are incompletely understood, and available therapies are inadequate. This review highlights recent advances in the structure and function of pronociceptive and antinociceptive G protein-coupled receptors (GPCRs) that provide insights into the mechanisms and treatment of chronic pain. This knowledge, derived from studies of somatic pain, can guide research into visceral pain. Mediators from injured tissues transiently activate GPCRs at the plasma membrane of neurons, leading to sensitisation of ion channels and acute hyperexcitability and nociception. Sustained agonist release evokes GPCR redistribution to endosomes, where persistent signalling regulates activity of channels and genes that control chronic hyperexcitability and nociception. Endosomally targeted GPCR antagonists provide superior pain relief in preclinical models. Biased agonists stabilise GPCR conformations that favour signalling of beneficial actions at the expense of detrimental side effects. Biased agonists of µ-opioid receptors (MOPrs) can provide analgesia without addiction, respiratory depression and constipation. Opioids that preferentially bind to MOPrs in the acidic microenvironment of diseased tissues produce analgesia without side effects. Allosteric modulators of GPCRs fine-tune actions of endogenous ligands, offering the prospect of refined pain control. GPCR dimers might function as distinct therapeutic targets for nociception. The discovery that GPCRs that control itch also mediate irritant sensation in the colon has revealed new targets. A deeper understanding of GPCR structure and function in different microenvironments offers the potential of developing superior treatments for GI pain.