Epigenetic mechanisms regulate the formation, consolidation and reconsolidation of memories. However, the signaling path from neuronal activation to epigenetic modifications within the memory-related brain circuit remains unknown. We report that learning induces long-lasting histone modifications in hippocampal memory-activated neurons to regulate memory stability. Neuronal activity triggers a late-onset shift in Nrxn1 splice isoform choice at splicing site 4 by accumulating a repressive histone marker, H3K9me3, to modulate the splicing process. Activity-dependent phosphorylation of p66α via AMP-activated protein kinase recruits HDAC2 and Suv39h1 to establish repressive histone markers and changes the connectivity of the activated neurons. Removal of Suv39h1 abolished the activity-dependent shift in Nrxn1 splice isoform choice and reduced the stability of established memories. We uncover a cell-autonomous process for memory preservation in which memory-related neurons initiate a late-onset reduction of their rewiring capacities through activity-induced histone modifications.