The efficacy and toxicity of trimethoprim-sulfamethoxazole (TMP-SMZ) as primary prophylaxis against Pneumocystis carinii pneumonia (PCP) for patients with human immunodeficiency virus (HIV) infection was assessed by comparing the effects of two dosages (480 or 960 mg once a day) of the drug. The multicenter trial involved 260 HIV-infected patients with CD4 cell counts < 0.2 x 10(9)/L and no history of PCP. Patients were randomly assigned to the treatment groups. After a median follow-up of 376 days (range, 1-1219), none of the patients developed PCP. Most adverse reactions that required discontinuation were seen within the first month of TMP-SMZ use and were seen more frequently and earlier in the 960-mg group (hazard ratio, 1.4; 95% confidence interval, 0.95-2.02; P = .007). For patients with HIV infection, 480 mg of TMP-SMZ is as efficacious as but less toxic than 960 mg of the drug for primary prophylaxis against PCP.