Poor sleep is associated with the risk of developing chronic pain, but how sleep contributes to pain chronicity remains unclear. Here we show that following peripheral nerve injury, cholinergic neurons in the anterior nucleus basalis (aNB) of the basal forebrain are increasingly active during nonrapid eye movement (NREM) sleep in a mouse model of neuropathic pain. These neurons directly activate vasoactive intestinal polypeptide-expressing interneurons in the primary somatosensory cortex (S1), causing disinhibition of pyramidal neurons and allodynia. The hyperactivity of aNB neurons is caused by the increased inputs from the parabrachial nucleus (PB) driven by the injured peripheral afferents. Inhibition of this pathway during NREM sleep, but not wakefulness, corrects neuronal hyperactivation and alleviates pain. Our results reveal that the PB-aNB-S1 pathway during sleep is critical for the generation and maintenance of chronic pain. Inhibiting this pathway during the sleep phase could be important for treating neuropathic pain.