This case control study assessed risk factors and prognostic indicators of 350 episodes of bacterial pneumonia in 285 HIV-infected patients. On univariate analysis, intravenous drug abuse (i.v.DA; p < .001 versus controls), regular cigarette smoking (p < .001), cirrhosis (p = .04), and history of a previous episode of pneumonia (p = .04) were risk factors for community-acquired episodes of bacterial pneumonia, whereas length of hospitalization (p = .01) was a risk factor only for nosocomial bacterial pneumonia. The small amount of circulating T CD4+ cells (<100/ mm3) was a risk factor in both groups of pneumonia (p < .05). Stepwise logistic regression analysis revealed that i.v.DA in community-acquired episodes and low levels of circulating T CD4+ cells, both in community-acquired and hospital-acquired episodes, were independent risk factors for the development of bacterial pneumonia. The case-fatality rate observed in our study was 27%. On stepwise logistic regression analysis, T CD4+ cell counts < or = 100/mm3 (p = .02), neutropenia (p = .04), PO2 arterial level < or = 70 mm Hg (p = .01), and Karnofsky score < or = 50 (p = .04) were independent indicators of mortality. According to a personally developed prognostic score, 211 episodes of pneumonia (60%) were classified as mild, 63 (18%) as moderate, and 76 (22%) as severe. Clinicians must carefully evaluate those variables that can influence the prognosis of bacterial pneumonia to make early identification of affected patients and to promptly establish the most appropriate therapeutic strategy in each case.