Extensive research provides evidence that neuroinflammation underlies numerous brain disorders. However, the molecular mechanisms by which inflammatory mediators determine synaptic and cognitive dysfunction occurring in neurodegenerative diseases (e.g., Alzheimer’s disease) are far from being fully understood. Here we investigated the role of interleukin 1β (IL-1β), and the molecular cascade downstream the activation of its receptor, to the synaptic dysfunction occurring in the mouse model of multiple Herpes simplex virus type-1 (HSV-1) reactivations within the brain. These mice are characterized by neuroinflammation and memory deficits associated with a progressive accumulation of neurodegenerative hallmarks (e.g., amyloid-β protein and tau hyperphosphorylation). Here we show that mice undergone two HSV-1 reactivations in the brain exhibited increased levels of IL-1β along with significant alterations of: (1) cognitive performances; (2) hippocampal long-term potentiation; (3) expression synaptic-related genes and pre- and post-synaptic proteins; (4) dendritic spine density and morphology. These effects correlated with activation of the epigenetic repressor MeCP2 that, in association with HDAC4, affected the expression of synaptic plasticity-related genes. Specifically, in response to HSV-1 infection, HDAC4 accumulated in the nucleus and promoted MeCP2 SUMOylation that is a post-translational modification critically affecting the repressive activity of MeCP2. The blockade of IL-1 receptors by the specific antagonist Anakinra prevented the MeCP2 increase and the consequent downregulation of gene expression along with rescuing structural and functional indices of neurodegeneration. Collectively, our findings provide novel mechanistic evidence on the role played by HSV-1-activated IL-1β signaling pathways in synaptic deficits leading to cognitive impairment.Supplementary InformationThe online version contains supplementary material available at 10.1007/s00018-023-04817-5.