The processing of pain in the central nervous system is now known to have an important immune component, including T cells. T cells have been shown to release endogenous opioids, and although it is well known that opioids have effects on T cell populations, very little attention has been given to the converse: how T cells may affect opioid regulation. We find here that in addition to displaying significantly increased baseline pain sensitivity across various pain modalities, T cell deficient mice exhibit pronounced deficiencies in morphine inhibition of thermal or inflammatory pain. Nude mice are also deficient in endogenous opioid-mediated analgesia, exhibiting no stress-induced analgesia from restraint. The relevant T cell subpopulation appears to be CD4 + T cells, since adoptive transfer of them but not CD8 + cells into nude mice rescues both the pain and morphine analgesia phenotypes. As previously reported, we also observe a sex difference in CD-1 mice, with females requiring 2–3-fold more morphine than males to produce equal analgesia. Nude mice display no sex differences in morphine analgesia, and the sex difference is restored in nude mice of either sex receiving CD4 + T cells from CD-1 donor male or female mice. These results suggest that CD4 + T cells play an as yet unappreciated role in opioid analgesia, and may be a driver of sex differences therein.