Mycoplasma (M.) hyopneumoniae interacts with the respiratory microbiota and facilitates colonization of other pathogens. The present study investigated the pulmonary and nasal microbiota of M. hyopneumoniae-infected and M. hyopneumoniae-free pigs. Sixty-six pigs from three commercial herds were selected at the end of the finishing phase: 44 originated from two M. hyopneumoniae-positive herds and 22 from a M. hyopneumoniae-negative farm. At the slaughterhouse, samples of nasal turbinate (NT) and bronchus-alveolar lavage fluid (BALF) were collected. DNA was extracted with a commercial kit and the infection status was confirmed by qPCR. All samples from the same herd were pooled, and next-generation sequencing based on the hypervariable region V3-V4 of the 16 s bacterial rDNA was performed. Data analysis included the taxonomic analysis, Alpha diversity indexes, and Principal coordinates analysis (Pcoa) using Jaccard, Bray-Curtis, Weighted Unifrac, and Unweighted Unifrac distances. All pigs from the infected herds tested PCR positive for M. hyopneumoniae, whereas all pigs from the negative farm were negative. There was a greater diversity of microorganisms in BALF when compared to NT samples in all the farms. BALF samples from infected animals showed higher abundance of M. hyopneumoniae than NT samples and a predominance of Pasteurella multocida among the main species identified, which was also abundant in the M. hyopneumoniae-free herd. PCoa diagrams indicated that for most of the samples, dissimilarity on bacterial composition was observed, regardless of infection status and sample type. Therefore, the lung microbiota was modulated by M. hyopneumoniae infection, which could play a role in the pathogenesis of M. hyopneumoniae-disease