Recent studies of the human Pneumocystis carinii dihydropteroate synthase (DHPS) gene suggest that P. carinii is developing resistance to sulfamethoxazole (SMX) and dapsone. To explore whether P. carinii is also developing resistance to trimethoprim (TMP), the human P. carinii dihydrofolate reductase (DHFR) gene was cloned, DHFR and DHPS genes in 37 P. carinii isolates from 35 patients were sequenced, and the relationship between TMP-SMX or dapsone use and gene mutations was analyzed. The DHFR gene sequences were identical in all isolates except 1 with a synonymous substitution. In contrast, the DHPS gene sequences showed mutations in 16 of the 37 isolates; prior sulfa/sulfone prophylaxis was associated with the presence of these mutations (P<.001). In addition to suggesting that there is less selective pressure on DHFR than on DHPS, this study reinforces the hypothesis that mutations in the DHPS gene are likely involved in the development of sulfa resistance in P. carinii.