Background: Although the use of antiretroviral therapy has led to dramatic declines in AIDS-associated mortality, Pneumocystis pneumonia (PCP) remains a leading cause of death in HIV-infected patients. Objectives: To measure mortality, identify predictors of mortality at time of illness presentation and derive a PCP mortality prediction rule that stratifies patients by risk for mortality. Methods: An observational cohort study with case note review of all HIV-infected persons with a laboratory diagnosis of PCP at San Francisco General Hospital from 1997 to 2006. Results: 451 patients were diagnosed with PCP on 524 occasions. In-hospital mortality was 10.3%. Multivariate analysis identified five significant predictors of mortality: age (adjusted odds ratio (AOR) per 10-year increase, 1.69; 95% CI 1.08 to 2.65; p = 0.02); recent injection drug use (AOR 2.86; 95% CI 1.28 to 6.42; p = 0.01); total bilirubin .0.6 mg/dl (AOR 2.59; 95% CI 1.19 to 5.62; p = 0.02); serum albumin ,3 g/dl (AOR 3.63; 95% CI 1.72-7.66; p = 0.001); and alveolar-arterial oxygen gradient >50 mm Hg (AOR 3.02; 95% CI 1.41 to 6.47; p = 0.004). Using these five predictors, a six-point PCP mortality prediction rule was derived that stratifies patients according to increasing risk of mortality: score 0-1, 4%; score 2-3, 12%; score 4-5, 48%. Conclusions: The PCP mortality prediction rule stratifies patients by mortality risk at the time of illness presentation and should be validated as a clinical tool.