Background: Studies indicate that the nasal microbiome may correlate strongly with the presence or future risk of childhood asthma. Objectives: In this study, we tested whether developmental trajectories of the nasopharyngeal microbiome in early life and the composition of the microbiome during illnesses were related to risk of childhood asthma. Methods: Children participating in the Childhood Origins of Asthma study (n=285) provided nasopharyngeal mucus samples in the first two years of life, during routine healthy study visits (2, 4, 6, 9, 12, 18 and 24 months of age) and episodes of respiratory illnesses, which were analyzed for respiratory viruses and bacteria. We identified developmental trajectories of early-life microbiome composition, as well as predominant bacteria during respiratory illnesses, and correlated these with presence of asthma at 6, 8, 11, 13 and 18 years of age. Results: Of the four microbiome trajectories identified, a Staphylococcus-dominant microbiome in the first 6 months of life was associated with increased risk of recurrent wheezing by age 3 years and asthma that persisted throughout childhood. In addition, this trajectory was associated with the early onset of allergic sensitization. During wheezing illnesses, detection of rhinoviruses and predominance of Moraxella were associated with asthma that persisted throughout later childhood. Conclusion: In infancy, the developmental composition of the microbiome during healthy periods and the predominant microbes during acute wheezing illnesses are both associated with the subsequent risk of developing persistent childhood asthma.