Astrocytes are glial cells that are abundant in the central nervous system (CNS) and that have important homeostatic and disease-promoting functions1. However, little is known about the homeostatic anti-inflammatory activities of astrocytes and their regulation. Here, using high-throughput flow cytometry screening, single-cell RNA sequencing and CRISPR–Cas9-based cell-specific in vivo genetic perturbations in mice, we identify a subset of astrocytes that expresses the lysosomal protein LAMP12 and the death receptor ligand TRAIL3. LAMP1+TRAIL+ astrocytes limit inflammation in the CNS by inducing T cell apoptosis through TRAIL–DR5 signalling. In homeostatic conditions, the expression of TRAIL in astrocytes is driven by interferon-γ (IFNγ) produced by meningeal natural killer (NK) cells, in which IFNγ expression is modulated by the gut microbiome. TRAIL expression in astrocytes is repressed by molecules produced by T cells and microglia in the context of inflammation. Altogether, we show that LAMP1+TRAIL+ astrocytes limit CNS inflammation by inducing T cell apoptosis, and that this astrocyte subset is maintained by meningeal IFNγ+ NK cells that are licensed by the microbiome.