Type 1 and type 2 cannabinoid receptors (CB1 and CB2, respectively) mediate cannabinoid-induced analgesia. Loss of endogenous CB1 is associated with hyperalgesia. However, the downstream targets affected by ablation of CB1 in primary sensory neurons remain unknown. In the present study, we hypothesized that conditional knockout of CB1 in primary sensory neurons (CB1cKO) alters downstream gene expression in the dorsal root ganglion (DRG) and that targeting these pathways alleviates neuropathic pain. We found that CB1cKO in primary sensory neurons induced by tamoxifen in adult Advillin-Cre:CB1-floxed mice showed persistent hyperalgesia. Transcriptome/RNA sequencing analysis of the DRG indicated that differentially expressed genes were enriched in energy regulation and complement and coagulation cascades at the early phase of CB1cKO, whereas pain regulation and nerve conduction pathways were affected at the late phase of CB1cKO. Chronic constriction injury in mice induced neuropathic pain and changed transcriptome expression in the DRG of CB1cKO mice, and differentially expressed genes were mainly associated with inflammatory and immune-related pathways. Nerve injury caused a much larger increase in CB2 expression in the DRG in CB1cKO than in wildtype mice. Interfering with downstream target genes of CB1, such as antagonizing CB2, inhibited activation of astrocytes, reduced neuroinflammation, and alleviated neuropathic pain. Our results demonstrate that CB1 in primary sensory neurons functions as an endogenous analgesic mediator. CB2 expression is regulated by CB1 and may be targeted for the treatment of neuropathic pain.