Accumulating evidence suggests that histone deacetylase inhibitor exert neuroprotective effects in animal models of neurological diseases. We investigated for the first time whether class I histone deacetylase inhibitor valproic acid (VPA) can reverse cognitive deficits in a mouse model of sepsis-associated encephalopathy (SAE). Moreover, the possible mechanisms of protection were also explored. A mouse model of SAE was induced in adult male mice by cecal ligation and puncture (CLP). Mice received an administration of saline or VPA (100 mg/kg) once daily for 14 consecutive days starting either immediately or 2 weeks after operation. Furthermore, the TrkB antagonist K252a was used in another group of experiment to investigate whether brain-derived neurotrophic factor (BDNF)-TrkB signaling pathway is involved in the protection of VPA. Our data suggested that CLP resulted in significant cognitive impairments accompanied by increased expressions in interleukin-1β and caspase-3, and decreased expressions in BDNF, phospho-TrkB (pTrkB), postsynaptic density 95, and synapses, which were reversed by VPA. However, TrkB antagonist K252a abolished the beneficial effects of VPA with regard to cognition and decreased pTrkB expression and synapses in the hippocampus. Taken together, the findings of the present study suggested chronic treatment with VPA reverses cognitive deficits through mechanisms probably via a reduction in inflammation and apoptosis in the brain, as well as the activation of the BDNF-TrkB signaling pathway in a mouse model of SAE.