The gut environment has been found to significantly influence autoimmune diseases such as multiple sclerosis; however, immune cell mechanisms are unclear. Here we show that the gut epithelium of myelin oligodendrocyte glycoprotein(35-55)-specific T-cell receptor transgenic mice contains environmental stimuli-induced intraepithelial lymphocytes (IELs) that inhibit experimental autoimmune encephalomyelitis on transfer. These cells express surface markers phenotypical of 'induced' IELs, have a TH17-like profile and infiltrate the central nervous system (CNS). They constitutively express Ctla4 and Tgfb1 and markedly upregulate Lag3 expression in the CNS, thereby inhibiting inflammation. We also demonstrate the suppressive capability of CD4(+) IELs with alternative antigen specificities, their proliferation in response to gut-derived antigens and contribution of the microbiota and dietary aryl hydrocarbon receptor ligands to their induction. Thus, the gut environment favours the generation of autoreactive CD4(+) T cells with unique regulatory functions, potentially important for preventing CNS autoimmunity.