Asthma is an increasing health problem worldwide, but the long-term temporal pattern of clinical symptoms is not understood and predicting asthma episodes is not generally possible. We analyse the time series of peak expiratory flows, a standard measurement of airway function that has been assessed twice daily in a large asthmatic population during a long-term crossover clinical trial. Here we introduce an approach to predict the risk of worsening airflow obstruction by calculating the conditional probability that, given the current airway condition, a severe obstruction will occur within 30 days. We find that, compared with a placebo, a regular long-acting bronchodilator (salmeterol) that is widely used to improve asthma control decreases the risk of airway obstruction. Unexpectedly, however, a regular short-acting beta2-agonist bronchodilator (albuterol) increases this risk. Furthermore, we find that the time series of peak expiratory flows show long-range correlations that change significantly with disease severity, approaching a random process with increased variability in the most severe cases. Using a nonlinear stochastic model, we show that both the increased variability and the loss of correlations augment the risk of unstable airway function. The characterization of fluctuations in airway function provides a quantitative basis for objective risk prediction of asthma episodes and for evaluating the effectiveness of therapy.