Introduction: Although long-term macrolide antibiotics could reduce the recurrent exacerbation of chronic obstructive pulmonary disease (COPD), the side effect of bacterial resistance and the impact on the microbiota remain concerning. We investigated the influence of long-term erythromycin treatment on the airway and gut microbiota in mice with emphysema and patients with COPD. Methods: We conducted 16S rRNA gene sequencing to explore the effect of erythromycin treatment on the lung and gut microbiota in mice with emphysema. Liquid chromatography-mass spectrometry was used for lung metabolomics. A randomized controlled trial was performed to investigate the effect of 48-week erythromycin treatment on the airway and gut microbiota in COPD patients. Results: The mouse lung and gut microbiota were disrupted after cigarette smoke exposure. Erythromycin treatment depleted harmful bacteria and altered lung metabolism. Erythromycin treatment did not alter airway or gut microbial diversity in COPD patients. It reduced the abundance of pathogens, such as Burkholderia, in the airway of COPD patients and increased levels of symbiotic bacteria, such as Prevotella and Veillonella. The proportions of Blautia, Ruminococcus, and Lachnospiraceae in the gut were increased in COPD patients after erythromycin treatment. The time to the first exacerbation following treatment was significantly longer in the erythromycin treatment group than in the COPD group. Conclusion: Long-term erythromycin treatment reduces airway and gut microbe abundance in COPD patients but does not affect microbial diversity and restores microbiota balance in COPD patients by reducing the abundance of pathogenic bacteria.