As major consumers of cellular metabolites, mitochondria are poised to compete with invading microbes for the nutrients they need to grow. Yet, whether cells weaponize mitochondrial metabolism during infection remains poorly understood. We found that the transcription factor ATF4 activates a mitochondrial defense based on the essential B vitamin folate. During infection with the intracellular pathogen Toxoplasma gondii, ATF4 increased mitochondrial DNA levels by driving the one-carbon metabolism processes that use folate in mitochondria. Triggered by host detection of mitochondrial stress induced by parasite effectors, ATF4 limited Toxoplasma access to folates required for dTMP synthesis, thereby restricting parasite growth. Thus, ATF4 rewires mitochondrial metabolism to mount a folate-based metabolic immunity against Toxoplasma.