Learning and memory impairment is a common clinical symptom of aging and nervous system injuries, and seriously affects quality of life. Memory impairment is associated with increased oxidative stress (OS) and inflammatory response. β-hydroxybutyrate (BHBA) is a water-soluble endogenous small-molecule ketone body that easily crosses the blood-brain barrier and has shown neuroprotection activities. In this study, we investigated the effects and mechanisms of BHBA on D-galactose (D-gal)-induced memory impairment in mice by in vitro and in vivo experiments. BHBA was administered intragastrically to D-gal-injured C57BL/6 mice for 42 days. Water maze performance, the morphology of the hippocampus with Nissl staining, the ACh content, OS, and inflammation status were examined. To further investigate the mechanism, hippocampal neuronal cells (HT22) were treated with BHBA with or without the SIRT1 inhibitor or small interfering RNAs against sirt1 (si-SIRT1) before incubation with D-gal. BHBA significantly improved water maze performance; increased the ACh content, SOD activity, and SIRT1 expression; and decreased AChE and LDH activity, ROS, MDA, IL-1β, TNF-α contents, and NLRP3 expression. Further studies with the SIRT inhibitor or siRNAs against sirt1 reversed the above effects of BHBA. Collectively, BHBA inhibited hippocampal OS and the inflammation process to alleviate learning and memory impairment through activating the SIRT1 pathway in D-gal-injured mice, suggesting that BHBA could be a potential option for drug development of learning and memory impairment induced by nervous system injuries.