Chronic neuroinflammation is a key pathological feature of neuropathic pain. The ketogenic diet (KD) has demonstrated potential to reduce neuronal excitability and alleviate inflammation in epilepsy, yet its effects and precise mechanisms in neuropathic pain remain elusive. We first observed that β-hydroxybutyrate (BHB), a key metabolite induced by KD, was reduced in mice following neuropathic pain induced by chronic constriction injury (CCI). Subsequently, we demonstrated that KD effectively alleviated CCI-induced thermal hyperalgesia and mechanical allodynia, while mitigating neuroinflammation through reduced microglial activation and pro-inflammatory cytokine levels. BHB reduced reactive oxygen species (ROS) production, which coincided with enhanced mitochondrial membrane potential in microglia, thereby attenuating microglia-mediated inflammatory responses. Both