A group of clinical, immunologic, and virologic variables was examined to determine if any predicted the development of hypersensitivity to trimethoprim-sulfamethoxazole (TMP-SMZ) during treatment of Pneumocystis carinii pneumonia in patients with human immunodeficiency virus (HIV) infection. Hypersensitivity occurred in 39 (27%) of 143 patients, who had significantly higher total lymphocyte and CD4+ and CD8+ cell counts and CD4:CD8 ratios than did those who did not develop hypersensitivity. Regression analysis identified having a CD4:CD8 ratio > 0.10 (95% confidence interval [CI], 1.75-3.94; P = .02) and treatment for < 14 days (95% CI, 1.57-3.75; P = .04) as independently predictive of hypersensitivity. Use of corticosteroids tended to reduce the frequency of hypersensitivity (7% vs. 30%; P = .07). T lymphocytes may be important in the pathogenesis of these hypersensitivity reactions. As the frequency of hypersensitivity declines with disease progression, T lymphocytes could be effector cells in these reactions or their sensitivity to TMP-SMZ may decline with HIV disease progression.