Pain is a dynamic and nonlinear experience shaped by injury and contextual factors, including expectations of future pain or relief 1 . While µ opioid receptors are central to the analgesic effects of opioid drugs, the endogenous opioid neurocircuitry underlying pain and placebo analgesia remains poorly understood. The ventrolateral column of the posterior periaqueductal gray is a critical hub for nociception and endogenous analgesia mediated by opioid signaling 2 . However, significant gaps remain in understanding the cell-type identities, the sub-second neural dynamics involved in pain modulation, the role of endogenous peptide neuromodulators, and the contextual factors influencing these processes. Using spatial mapping with single-nuclei RNA sequencing of pain-active neurons projecting to distinct long-range brain targets, alongside cell type-specific and activity-dependent genetic tools for in vivo optical recordings and modulation of neural activity and opioid peptide release, we identified a functional dichotomy in the ventrolateral periaqueductal gray. Neurons expressing µ opioid receptors encode active nociceptive states, whereas enkephalin-releasing neurons drive pain relief during recovery from injury, in response to learned fear predictions, and during placebo analgesia. Finally, by leveraging the functional effects of placebo analgesia, we used direct optogenetic activation of vlPAG enkephalin neurons to drive opioid peptide release, resulting in a robust reduction in pain. These findings show that diverse need states converge on a shared midbrain circuit that releases endogenous opioids with high spatiotemporal precision to suppress nociceptive activity and promote analgesia.