In a meta-analysis, we examined the efficacy of aerosolized pentamidine, trimethoprim-sulfamethoxazole, and dapsone or dapsone/pyrimethamine for the prevention of Pneumocystis carinii pneumonia and toxoplasma encephalitis in patients with HIV infection. Of 22 trials, 13 compared trimethoprim-sulfamethoxazole with aerosolized pentamidine, nine compared dapsone alone or in combination with pyrimethamine with aerosolized pentamidine, and eight compared trimethoprim-sulfamethoxazole with dapsone/pyrimethamine. In total, 1484 patients were treated with trimethoprim-sulfamethoxazole, 1548 patients with dapsone/pyrimethamine or dapsone, and 1800 patients with aerosolized pentamidine. For dapsone/pyrimethamine versus aerosolized pentamidine, the risk ratio for P. carinii pneumonia was 0.90 (95% confidence interval [CI], 0.71-1.15), and for toxoplasma encephalitis it was 0.72 (95% CI, 0.54-0.97). For trimethoprim-sulfamethoxazole versus aerosolized pentamidine, the risk ratio of P. carinii pneumonia was 0.59 (95% CI, 0.45-0.76), and for toxoplasma encephalitis it was 0.78 (95% CI, 0.55-1.11). For trimethoprim-sulfamethoxazole versus dapsone/pyrimethamine, the risk ratio of P. carinii pneumonia was 0.49 (95% CI, 0.26-0.92), and for toxoplasma encephalitis it was 1.17 (95% CI, 0.68-2.04). Although current evidence does not allow a definitive recommendation, administration of trimethoprim-sulfamethoxazole for prophylaxis of P. carinii pneumonia and toxoplasmosis in patients with HIV infection is consistent with the available data.