Despite the plant health-promoting effects of plant microbiota, these assemblages also comprise potentially detrimental microbes. How plant immunity controls its microbiota to promote plant health under these conditions remains largely unknown. We find that commensal bacteria isolated from healthy Arabidopsis plants trigger diverse patterns of reactive oxygen species (ROS) production dependent on the immune receptors and completely on the NADPH oxidase RBOHD that selectively inhibited specific commensals, notably Xanthomonas L148. Through random mutagenesis, we find that L148 gspE, encoding a type II secretion system (T2SS) component, is required for the damaging effects of Xanthomonas L148 on rbohD mutant plants. In planta bacterial transcriptomics reveals that RBOHD suppresses most T2SS gene expression including gspE. L148 colonization protected plants against a bacterial pathogen, when gspE was inhibited by ROS or mutation. Thus, a negative feedback loop between Arabidopsis ROS and the bacterial T2SS tames a potentially detrimental leaf commensal and turns it into a microbe beneficial to the host.