The objective was to investigate the association between self-reported sleep problems and risk of chronic pain in the low back and neck/shoulders, and whether physical exercise and body mass index (BMI) alter this association. The study comprised data on 26 896 women and men in the Nord-Trøndelag Health Study (Norway) without chronic pain or physical impairment at baseline in 1984-86. Occurrence of chronic pain was assessed at follow-up in 1995-97. A generalized linear model was used to calculate adjusted risk ratios. Sleep problems were dose-dependently associated with risk of pain in the low back and neck/shoulders in both women and men (P < 0.001 both genders). Women and men who reported sleep problems 'sometimes' and 'often/always' had a higher risk of chronic pain of 23-32% and 51-66%, respectively, than those who reported sleep problems 'never'. Combined analyses showed that persons with sleep problems 'sometimes' and who exercised ≥1 hour per week had lower risk of chronic pain in the low back (P < 0.04) and neck/shoulders (P < 0.001) than inactive persons with a similar level of sleep problems (P < 0.04). Likewise, persons with BMI <25 kg/cm(2) and sleep problems 'sometimes' had lower risk of chronic pain in the low back (P < 0.001) and neck/shoulders (P < 0.001) than persons with BMI ≥25 kg/cm(2) and a similar level of sleep problems. Sleep problems are associated with an increased risk of chronic pain in the low back and neck/shoulders. Regular exercise and maintenance of normal body weight may reduce the adverse effect of mild sleep problems on risk of chronic pain.