Pneumococcal polysaccharide vaccine (PPV-23) has been recommended for HIV-infected adults. We investigated factors that could influence PPV-23 effectiveness against all-cause pneumonia in a longitudinal cohort of 23,255 HIV-infected adults receiving care during 1998--2003. Patients who received PPV-23 had a lower rate of pneumonia (IRR = 0.8; 95% CI: 0.8-0.9) than patients who had never been vaccinated, independent of recent CD4 count, HIV viral load, antiretroviral therapy, and history of pneumonia. However, PPV-23 provided no benefit when patients were vaccinated at HIV viral load > 100,000 copies/ml, irrespective of CD4 count at vaccination. Receipt of PPV-23 was associated with lower incidence of all-cause pneumonia.