Preclinical data have shown that proton pump inhibitors (PPI) can modulate the microbiome, and single-arm studies suggested that antibiotics (ATB) may decrease the efficacy of immune checkpoint inhibitors (ICI), but randomized controlled trial data are lacking. This pooled analysis evaluated the effect of ATB and PPI on outcome in patients randomized between ICI and chemotherapy.This retrospective analysis used pooled data from the phase II POPLAR (NCT01903993) and phase III OAK (NCT02008227) trials, which included 1512 patients with previously treated non-small-cell lung cancer (NSCLC) randomly assigned to receive atezolizumab (n= 757) or docetaxel (n= 755). The main objective of this analysis was to assess the impact of ATB and PPI use on overall survival (OS) and progression-free survival (PFS).A total of 169 (22.3%) patients in the atezolizumab group and 202 (26.8%) in the docetaxel group received ATB, and 234 (30.9%) and 260 (34.4%), respectively, received PPI. Multivariate analysis in all patients revealed that ATB were associated with shorter OS [hazard ratio (HR) 1.20, 95% confidence interval (CI) 1.04-1.39], as was PPI (HR 1.26, 95% CI 1.10-1.44). Within the atezolizumab population, OS was significantly shorter in patients who received ATB (8.5 versus 14.1 months, HR 1.32, 95% CI 1.06-1.63, P= 0.01) or PPI (9.6 versus 14.5 months, HR 1.45, 95% CI 1.20-1.75, P=0.0001). PPI use was associated with shorter PFS in the atezolizumab population (1.9 versus 2.8 months, HR 1.30, 95% CI 1.10-1.53, P= 0.001). There was no association between ATB and PPI use and PFS or OS within the docetaxel population.In this unplanned analysis from two randomized trials, data suggest that ATB or PPI use in patients with metastatic NSCLC is associated with poor outcome and may influence the efficacy of ICI.