Bacteria may play a role in esophageal adenocarcinoma (EAC) and esophageal squamous cell carcinoma (ESCC), although evidence is limited to cross-sectional studies. In this study, we examined the relationship of oral microbiota with EAC and ESCC risk in a prospective study nested in two cohorts. Oral bacteria were assessed using 16S rRNA gene sequencing in prediagnostic mouthwash samples from n = 81/160 EAC and n = 25/50 ESCC cases/matched controls. Findings were largely consistent across both cohorts. Metagenome content was predicted using PiCRUST. We examined associations between centered log-ratio transformed taxon or functional pathway abundances and risk using conditional logistic regression adjusting for BMI, smoking, and alcohol. We found the periodontal pathogen Tannerella forsythia to be associated with higher risk of EAC. Furthermore, we found that depletion of the commensal genus Neisseria and the species Streptococcus pneumoniae was associated with lower EAC risk. Bacterial biosynthesis of carotenoids was also associated with protection against EAC. Finally, the abundance of the periodontal pathogen Porphyromonas gingivalis trended with higher risk of ESCC. Overall, our findings have potential implications for the early detection and prevention of EAC and ESCC. Cancer Res; 77(23); 6777–87. ©2017 AACR.