By combining microbiota depletion, gnotobiotic approaches with cultured commensal bacteria, and models of respiratory infection, we demonstrate that the microbiota promotes pulmonary clearance of Gram-positive and Gram-negative pathogens via granulocyte–macrophage colony-stimulating factor (GM-CSF). This evidence concerns the gene CSF2 and respiratory tract infectious disorder.