2-Arachidonoylglycerol (2-AG) is the most prevalent endocannabinoid involved in maintaining brain homeostasis. Previous studies have demonstrated that inactivating monoacylglycerol lipase (MAGL), the primary enzyme responsible for degrading 2-AG in the brain, alleviates neuropathology and prevents synaptic and cognitive decline in animal models of neurodegenerative diseases. However, we show that selectively inhibiting 2-AG metabolism in neurons impairs cognitive function in mice. This cognitive impairment appears to result from decreased expression of synaptic proteins and synapse numbers, impaired long-term synaptic plasticity and cortical circuit functional connectivity, and diminished neurogenesis. Interestingly, the synaptic and cognitive deficits induced by neuronal MAGL inactivation can be counterbalanced by inhibiting astrocytic 2-AG metabolism. Transcriptomic analyses reveal that inhibiting neuronal 2-AG degradation leads to widespread changes in expression of genes associated with synaptic function. These findings suggest that crosstalk in 2-AG signaling between astrocytes and neurons is crucial for maintaining synaptic and cognitive functions and that excessive 2-AG in neurons alone is detrimental to cognitive function.