Genetic regulators and environmental stimuli modulate T cell activation in autoimmunity and cancer. The enzyme co-factor tetrahydrobiopterin (BH4) is involved in the production of monoamine neurotransmitters, the generation of nitric oxide, and pain1,2. Here we uncover a link between these processes, identifying a fundamental role for BH4 in T cell biology. We find that genetic inactivation of GTP cyclohydrolase 1 (GCH1, the rate-limiting enzyme in the synthesis of BH4) and inhibition of sepiapterin reductase (the terminal enzyme in the synthetic pathway for BH4) severely impair the proliferation of mature mouse and human T cells. BH4 production in activated T cells is linked to alterations in iron metabolism and mitochondrial bioenergetics. In vivo blockade of BH4 synthesis abrogates T-cell-mediated autoimmunity and allergic inflammation, and enhancing BH4 levels through GCH1 overexpression augments responses by CD4- and CD8-expressing T cells, increasing their antitumour activity in vivo. Administration of BH4 to mice markedly reduces tumour growth and expands the population of intratumoral effector T cells. Kynurenine-a tryptophan metabolite that blocks antitumour immunity-inhibits T cell proliferation in a manner that can be rescued by BH4. Finally, we report the development of a potent SPR antagonist for possible clinical use. Our data uncover GCH1, SPR and their downstream metabolite BH4 as critical regulators of T cell biology that can be readily manipulated to either block autoimmunity or enhance anticancer immunity.