Metabolic rewiring is essential for Th17 cells' functional identity to sense and interpret environmental cues. However, the environmental metabolic checkpoints with specific regulation of Th17 cells, manifesting potential therapeutic opportunities to autoimmune diseases, remain largely unknown. Here, by screening more than one hundred compounds derived from intestinal microbes or diet, we found that vitamin B5 (VB5) restrains Th17 cell differentiation as well as related autoimmune diseases such as experimental autoimmune encephalomyelitis and colitis. Mechanistically, VB5 is catabolized into coenzyme A (CoA) in a pantothenate kinase (PANK)-dependent manner, and in turn, CoA binds to pyruvate kinase isoform 2 (PKM2) to impede its phosphorylation and nuclear translocation, thus inhibiting glycolysis and STAT3 phosphorylation. In humans, reduced serum VB5 levels are found in both IBD and MS patients. Collectively, our study demonstrates a role of VB5 in Th17 cell metabolic reprograming, thus providing a potential therapeutic intervention for Th17 cell-associated autoimmune diseases.