To investigate the impact of regular physical exercise on sleep, we assessed sleep–wake behaviour in male C57BL/6N mice with and without long-term access (i.e. 4 weeks) to a running wheel. We studied sleep–wake behaviour during undisturbed conditions as well as after social stress. The exercising mice ran approximately 4 km/day, which affected their physical constitution, their spontaneous sleep–wake pattern and their endocrine and sleep responses to stress. When compared with the control mice, exercising animals had more muscle substance, less body fat and heavier adrenal glands. At baseline, exercising mice showed fewer, but longer-lasting, sleep episodes (indicating improved sleep consolidation) and less rapid-eye-movement sleep. In both control and exercising mice, mild social stress (elicited by a 15-min social conflict) evoked elevated plasma levels of adrenocorticotrophic hormone and corticosterone, an increase in non-rapid-eye-movement sleep, an enhancement of low-frequency activity in the electroencephalogram within non-rapid-eye-movement sleep (indicating increased sleep intensity) and a decrease in wakefulness. However, as compared with the control animals, exercising mice responded to social stress with higher corticosterone levels, but not adrenocorticotrophic hormone levels, suggesting an increased sensitivity of their adrenal glands to adrenocorticotrophic hormone. Moreover, in control mice, social stress increased rapid-eye-movement sleep in parallel to non-rapid-eye-movement sleep, whereas this stressor selectively decreased rapid-eye-movement sleep in exercising animals. Corticosterone is known to decrease rapid-eye-movement sleep. Therefore, changes in the regulation of the hypothalamic-pituitary-adrenocortical axis as a result of the long-term exercise may contribute to the observed differences in spontaneous and social stress-affected sleep. In conclusion, regular exercise appears to increase sleep quality and reverses the effects of mild social stress on rapid-eye-movement sleep.