T helper 17 (Th17) cells are prominently featured in multiple autoimmune diseases, but the regulatory mechanisms that control Th17 cell responses are poorly defined. Here we found that stimulation of OX40 triggered a robust chromatin remodeling response and produced a “closed” chromatin structure at interleukin-17 (IL-17) locus to inhibit Th17 cell function. OX40 activated the NF-κB family member RelB, and RelB recruited the histone methyltransferases G9a and SETDB1 to the Il17 locus to deposit “repressive” chromatin marks at H3K9 sites, and consequently repressing IL-17 expression. Unlike its transcriptional activities, RelB acted independently of both p52 and p50 in the suppression of IL-17. In an experimental autoimmune encephalomyelitis (EAE) disease model, we found that OX40 stimulation inhibited IL-17 and reduced EAE. Conversely, RelB-deficient CD4+ T cells showed enhanced IL-17 induction and exacerbated the disease. Our data uncover a mechanism in the control of Th17 cells that might have important clinic implications.