Proinflammatory cytokines have been shown to impair cognition; consequently, immune activity in the central nervous system was considered detrimental to cognitive function. Unexpectedly, however, T cells were recently shown to support learning and memory, though the underlying mechanism was unclear. We show that one of the steps in the cascade of T cell-based support of learning and memory takes place in the meningeal spaces. Performance of cognitive tasks led to accumulation of IL-4-producing T cells in the meninges. Depletion of T cells from meningeal spaces skewed meningeal myeloid cells toward a proinflammatory phenotype. T cell-derived IL-4 was critical, as IL-4 -/- mice exhibited a skewed proinflammatory meningeal myeloid cell phenotype and cognitive deficits. Transplantation of IL-4-/- bone marrow into irradiated wild-type recipients also resulted in cognitive impairment and proinflammatory skew. Moreover, adoptive transfer of T cells from wildtype into IL-4-/- mice reversed cognitive impairment and attenuated the proinflammatory character of meningeal myeloid cells. Our results point to a critical role for T cell-derived IL-4 in the regulation of cognitive function through meningeal myeloid cell phenotype and brain-derived neurotrophic factor expression. These findings might lead to the development of new immune-based therapies for cognitive impairment associated with immune decline.