Most drugs used for prevention and treatment of Pneumocystis jirovecii pneumonia target enzymes involved in the biosynthesis of folic acid, i.e., dihydropteroate synthase (DHPS) and dihydrofolate reductase (DHFR). Emergence of P. jirovecii drug resistance has been suggested by the association between failure of prophylaxis with sulfa drugs and mutations in DHPS. However, data on the occurrence of mutations in DHFR, the target of trimethoprim and pyrimethamine, are scarce. We examined polymorphisms in P. jirovecii DHFR from 33 patients diagnosed with P. jirovecii pneumonia who were receiving prophylaxis with a DHFR inhibitor (n = 15), prophylaxis without a DHFR inhibitor (n = 11), or no prophylaxis (n = 7). Compared to the wild-type sequence present in GenBank, 19 DHFR nucleotide substitution sites were found in 18 patients with 3 synonymous and 16 nonsynonymous mutations. Of 16 amino acid changes, 6 were located in positions conserved among distant organisms, and five of these six positions are probably involved in the putative active sites of the enzyme. Patients with failure of prophylaxis, including a DHFR inhibitor, were more likely to harbor nonsynonymous DHFR mutations than those who did not receive such prophylaxis (9 of 15 patients versus 2 of 18; P = 0.008). Analysis of the rate of nonsynonymous versus synonymous mutations was consistent with selection of amino acid substitutions in patients with failure of prophylaxis including a DHFR inhibitor. The results suggest that P. jirovecii populations may evolve under selective pressure from DHFR inhibitors, in particular pyrimethamine, and that DHFR mutations may contribute to P. jirovecii drug resistance.