Diffuse noxious inhibitory control (DNIC), which involves endogenous pain modulation, has been investigated as a potential mechanism for the differences in pain modulation observed between men and women, though the literature shows contradictory findings. We used a capsaicin-induced DNIC behavioral assay and resting state functional magnetic resonance imaging (rsfMRI) to assess the effect of testosterone on pain modulation and related brain circuitry in rats. We hypothesized that testosterone is required for DNIC that leads to efficient pain inhibition by increasing descending pain modulation. Male, female, and orchidectomized (GDX) male rats had a capsaicin injection into the forepaw to induce DNIC and mechanical thresholds were observed on the hindpaw. rsfMRI scans were acquired before and after capsaicin injection to analyze the effects of DNIC on periaqueductal gray (PAG), anterior cingulate cortex (ACC) and nucleus accumbens (NAc) connectivity to the whole brain. The strength of DNIC was higher in males compared to females and GDX males. PAG connectivity with prelimbic cortex (PrL), ACC and insula was stronger in males compared to females and GDX males, whereas females and GDX males had increased connectivity between the right ACC, hippocampus and thalamus. GDX males also showed a stronger connectivity between right ACC and NAc, and right NAc with PrL, ACC, insula and thalamus. Our findings suggest that testosterone plays a key role in reinforcing the endogenous pain inhibitory system, while circuitries related to reward and emotion are more strongly recruited in the absence of testosterone.