Prior studies have suggested gut microbiome changes induced by long-term acid-reducing medication use could modulate immunotherapy efficacy and toxicity. We assessed the relationship between baseline acid-reducing medication use (proton pump inhibitors [PPI] or H2 antagonists [H2A]) on treatment-related toxicity and efficacy in a large cohort of stage III non-small-cell lung cancer (NSCLC) patients treated with or without immunotherapy. Patients with unresectable stage III NSCLC treated with primary concurrent chemoradiation with or without adjuvant durvalumab from 2015 to 2021 were identified in the Veterans Affairs (VA) system. We defined baseline acid-reducing medication use with VA and non-VA pharmacy records in the year prior to radiation start; the number of prescriptions and the cumulative duration of therapy were quantified. Using multivariable Cox models adjusting for potential baseline confounders and stratified by adjuvant durvalumab use, we estimated the association between PPI or H2A use and subsequent severe pneumonitis, progression-free survival, and overall survival. Pneumonitis was determined and graded by manual chart review. We included 1994 patients with stage III NSCLC treated with primary chemoradiation, of whom 1005 (50%) received adjuvant durvalumab, 1064 (53%) received any PPI and 1030 (52%) received any H2A. In the overall sample, baseline use of any PPI was associated with increased risk of grade 3-5 pneumonitis (adjusted hazard ratio [aHR] 1.53, 95% CI 1.12-2.10, p = 0.008) and was found to be significant only in durvalumab-treated patients (aHR 1.67, 95% CI 1.10-2.54, p = 0.016), but not for patients treated without durvalumab (aHR 1.34, 95% CI 0.82-2.20, p = 0.2). Higher number of PPI prescriptions were associated with increased risk of severe pneumonitis (aHR 1.38 per 5 prescriptions, 95% CI 1.03-1.85, p = 0.03) and longer duration of PPIs trended toward significance (aHR 1.04 per 90 days, 95% CI 1.00-1.09, p = 0.066). Any PPI use was associated with worse OS in durvalumab-treated patients (aHR 1.30, 95% CI 1.05-1.61, p = 0.016) but not for patients without durvalumab use (aHR 0.99, 95% CI 0.86-1.14, p = 0.9). PPI use had no association with progression-free survival in either cohort. No significant associations between baseline H2A use and pneumonitis, PFS, or OS in either cohort were seen. PPIs, but not H2As, are associated with increased risk of treatment-related pneumonitis and inferior OS in stage III NSCLC patients treated with chemoradiation and immunotherapy. This association was not observed among patients treated with chemoradiation alone. No association was found between PPI use and cancer progression. Further work is warranted to confirm these findings in other immunotherapy-treated cohorts.