'Complexity science' is a rapidly developing research direction with applications in a multitude of fields that study complex systems consisting of a number of nonlinear elements with interesting dynamics and mutual interactions. This Theme Issue 'The complexity of sleep' aims at fostering the application of complexity science to sleep research, because the brain in its different sleep stages adopts different global states that express distinct activity patterns in large and complex networks of neural circuits. This introduction discusses the contributions collected in the present Theme Issue. We highlight the potential and challenges of a complex systems approach to develop an understanding of the brain in general and the sleeping brain in particular. Basically, we focus on two topics: the complex networks approach to understand the changes in the functional connectivity of the brain during sleep, and the complex dynamics of sleep, including sleep regulation. We hope that this Theme Issue will stimulate and intensify the interdisciplinary communication to advance our understanding of the complex dynamics of the brain that underlies sleep and consciousness.