Mechanisms governing how immune cells and their derived molecules impact homeostatic brain function are still poorly understood. Here, we elucidate neuronal mechanisms underlying T cell effects on synaptic function and episodic memory. Depletion of CD4 T cells led to memory deficits and impaired long-term potentiation. Severe combined immune-deficient mice exhibited amnesia, which was reversible by repopulation with T cells from wild-type but not from IL-4-knockout mice. Behaviors impacted by T cells were mediated via IL-4 receptors expressed on neurons. Exploration of snRNA-seq of neurons participating in memory processing provided insights into synaptic organization and plasticity-associated pathways regulated by immune cells. IL-4Rα knockout in inhibitory (but not in excitatory) neurons was sufficient to impair contextual fear memory, and snRNA-seq from these mice pointed to IL-4-driven regulation of synaptic function in promoting memory. These findings provide new insights into complex neuroimmune interactions at the transcriptional and functional levels in neurons under physiological conditions.