To determine the association between trimethoprim-sulfamethoxazole (TMP-SMX) prophylaxis for Pneumocystis carinii pneumonia and risk of bacterial infections in persons with AIDS, we abstracted hospital records from 6496 adult admissions to 42 hospitals in western Washington state. Of these admissions, 570 involved 637 bacterial infections diagnosed among patients who had been prescribed prophylactic TMP-SMX or aerosolized pentamidine. Cases [admissions with bacteraemia, bacterial pneumonia, acute or chronic sinusitis, or urinary tract infection (UTI)] were compared to controls (admissions not associated with any of the 5 bacterial infections). After adjusting for CD4 lymphocyte count and presence of P. carinii pneumonia, TMP-SMX prophylaxis, relative to aerosolized pentamidine prophylaxis, was associated with a reduced risk of bacteraemia (adjusted OR = 0.5; 95% CI, 0.2-1.0; P = 0.04), bacterial pneumonia (adjusted OR = 0.5; 95% CI, 0.3-0.8; P = 0.01), acute sinusitis (adjusted OR = 0.5; 95% CI, 0.2-1.3; P = 0.2), chronic sinusitis (adjusted OR = 0.3; 95% CI, 0.1-0.7; P = 0.01), and UTI (adjusted OR = 0.5; 95% CI, 0.2-1.2; P = 0.1), and all 5 bacterial infections combined (adjusted OR = 0.6; 95% CI, 0.5-0.8; P < 0.001).