Background Humoral immunity plays an important role against Pneumocystis jirovecii infection, yet clinical and environmental factors that impact bronchoalveolar antibody responses to P. jirovecii remain uncertain. Methods From October 2008—December 2011 we enrolled consecutive HIV-infected adults admitted to San Francisco General Hospital (SFGH) who underwent bronchoscopy for suspected Pneumocystis pneumonia (PCP). We used local air quality monitoring data to assign ozone, nitrogen dioxide, and fine particulate matter exposures within 14 days prior to hospital admission. We quantified serum and bronchoalveolar lavage fluid (BALF) antibody responses to P. jirovecii major surface glycoprotein (Msg) recombinant constructs using ELISA. We then fit linear regression models to determine whether PCP and ambient air pollutants were associated with bronchoalveolar antibody responses to Msg. Results Of 81 HIV-infected patients enrolled, 47 (58%) were diagnosed with current PCP and 9 (11%) had a prior history of PCP. The median CD4+ count was 51 cells/?l (IQR 15–129) and 44% were current smokers. Serum antibody responses to Msg were statistically significantly predictive of BALF antibody responses, with the exception of IgG responses to MsgC8 and MsgC9. Prior PCP was associated with increased BALF IgA responses to Msg and current PCP was associated with decreased IgA responses. For instance, among patients without current PCP, those with prior PCP had a median 73.2 U (IQR 19.2–169) IgA response to MsgC1 compared to a 5.00 U (3.52–12.6) response among those without prior PCP. Additionally, current PCP predicted a 22.5 U (95%CI -39.2, -5.82) lower IgA response to MsgC1. Ambient ozone within the two weeks prior to hospital admission was associated with decreased BALF IgA responses to Msg while nitrogen dioxide was associated with increased IgA responses. Conclusions PCP and ambient air pollutants were associated with BALF IgA responses to P. jirovecii in HIV-infected patients evaluated for suspected PCP.