Astrocytes control brain activity via both metabolic processes and gliotransmission, but the physiological links between these functions are scantly known. Here we show that endogenous activation of astrocyte type-1 cannabinoid (CB1) receptors determines a shift of glycolysis towards the lactate-dependent production of D-serine, thereby gating synaptic and cognitive functions in male mice. Mutant mice lacking the CB1 receptor gene in astrocytes (GFAP-CB1-KO) are impaired in novel object recognition (NOR) memory. This phenotype is rescued by the gliotransmitter D-serine, by its precursor L-serine, and also by lactate and 3,5-DHBA, an agonist of the lactate receptor HCAR1. Such lactate-dependent effect is abolished when the astrocyte-specific phosphorylated-pathway (PP), which diverts glycolysis towards L-serine synthesis, is blocked. Consistently, lactate and 3,5-DHBA promoted the co-agonist binding site occupancy of CA1 post-synaptic NMDA receptors in hippocampal slices in a PP-dependent manner. Thus, a tight cross-talk between astrocytic energy metabolism and gliotransmission determines synaptic and cognitive processes.