Background: Long-term macrolide treatment has proven benefit in inflammatory airways diseases, but whether it leads to changes in the composition of respiratory microbiota is unknown. We aimed to assess whether long-term, low-dose erythromycin treatment changes the composition of respiratory microbiota in people with non-cystic fibrosis bronchiectasis. Methods: Microbiota composition was determined by 16S rRNA gene sequencing of sputum samples from participants in the BLESS trial, a 12-month, double-blind, placebo-controlled trial of twice-daily erythromycin ethylsuccinate (400 mg) in adult patients with non-cystic fibrosis bronchiectasis and at least two infective exacerbations in the preceding year. The primary outcome was within-patient change in respiratory microbiota composition (assessed by Bray-Curtis index) between baseline and week 48, comparing erythromycin with placebo. The BLESS trial is registered with the Australian New Zealand Clinical Trials Registry, number ACTRN12608000460303. Findings: The BLESS trial took place between Oct 15, 2008, and Dec 14, 2011. Paired sputum samples were available from 86 randomly assigned patients, 42 in the placebo group and 44 in the erythromycin group. The change in microbiota composition between baseline and week 48 was significantly greater with erythromycin than with placebo (median Bray-Curtis score 0·52 [IQR 0·14-0·78] vs 0·68 [0·46-0·93]; median difference 0·16, 95% CI 0·01-0·33; p=0·03). In patients with baseline airway infection dominated by Pseudomonas aeruginosa, erythromycin did not change microbiota composition significantly. In those with infection dominated by organisms other than P aeruginosa, erythromycin caused a significant change in microbiota composition (p=0·03 [by analysis of similarity]), representing a reduced relative abundance of Haemophilus influenzae (35·3% [5·5-91·6] vs 6·7% [0·8-74·8]; median difference 12·6%, 95% CI 0·4-28·3; p=0·04; interaction p=0·02) and an increased relative abundance of P aeruginosa (0·02% [0·00-0·33] vs 0·13% [0·01-39·58]; median difference 6·6%, 95% CI 0·1-37·1; p=0·002; interaction p=0·45). Compared with placebo, erythromycin reduced the rate of pulmonary exacerbations over the 48 weeks of the study in patients with P aeruginosa-dominated infection (median 1 [IQR 0-3] vs 3 [2-5]; median difference -2, 95% CI -4 to -1; p=0·01), but not in those without P aeruginosa-dominated infection (1 [0-2] vs 1 [0-3]; median difference 0, -1 to 0; p=0·41; interaction p=0·04). Interpretation: Long-term erythromycin treatment changes the composition of respiratory microbiota in patients with bronchiectasis. In patients without P aeruginosa airway infection, erythromycin did not significantly reduce exacerbations and promoted displacement of H influenzae by more macrolide-tolerant pathogens including P aeruginosa. These findings argue for a cautious approach to chronic macrolide use in patients without P aeruginosa airway infection. Funding: Mater Adult Respiratory Research Trust Fund.