Background Neuropathic pain presents a significant clinical challenge, with spinal cord epigenetic mechanisms playing a critical role in its development. This study investigated the impact of nerve injury on the Barrier-to-Autointegration Factor (BAF) in the rat spinal dorsal horn. Methods Adult Sprague-Dawley rats underwent spinal nerve ligation (SNL) to model neuropathic pain. Pain behaviors were assessed using von Frey and burrow tests. Biochemical analyses measured mRNA and protein expression in the dorsal horn. Results SNL elevated BAF levels, which interacts with LEM domain–containing protein 2 (LEMD2), activating the histone-modifying enzyme EZH2. This enzyme adds a gene-silencing mark, H3K27me3, to the promoter region of the Oprm1 gene, which encodes the mu-opioid receptor. Consequently, the expression of the mu-opioid receptor is decreased, potentially contributing to neuropathic pain. Using gene knockdown techniques to reduce BAF expression, we reversed the changes in LEMD2, EZH2, and mu-opioid receptor expressions induced by SNL and attenuated mechanical allodynia. Additionally, knocking down LEMD2 disrupted the binding of BAF to the Oprm1 promoter, without affecting BAF levels. Inhibiting EZH2 also reversed the signaling without altering BAF and LEMD2 levels. Glutamate activated BAF pathways via pNR2B receptors, and NR2B receptor blockade reversed this effect. Conclusion These findings suggest that spinal pNR2B receptors may activate BAF, which interacts with LEMD2 to enhance EZH2-mediated H3K27me3 at the mu-opioid receptor promoter after nerve injury. Targeting this pathway may offer novel strategies to inhibit neuropathic pain.