Pneumocystis jirovecii is an opportunistic fungus that can cause severe and potentially fatal Pneumocystis pneumonia (PCP) in immunodeficient patients. In this study, we investigated the genetic polymorphisms of P. jirovecii at eight different loci, including six nuclear genes (ITS, 26S rRNA, sod, dhps, dhfr and β-Tub) and two mitochondrial genes (mtLSU-rRNA and cyb) in three PCP cases, including two patients with HIV infection and one without HIV infection in Shanxi Province, P.R. China. The gene targets were amplified by PCR followed by sequencing of plasmid clones. The HIV-negative patient showed a coinfection with two genotypes of P. jirovecii at six of the eight loci sequenced. Of the two HIV-positive patients, one showed a coinfection with two genotypes of P. jirovecii at the same two of the six loci as in the HIV-negative patient, while the other showed a single infection at all eight loci sequenced. None of the three drug target genes (dhfr, dhps and cyb) showed mutations known to be potentially associated with drug resistance. This is the first report of genetic polymorphisms of P. jirovecii in PCP patients in Shanxi Province, China. Our findings expand our understanding of the genetic diversity of P. jirovecii in China.