Poor quality of sleep is a widespread issue in modern society, and even children are being diagnosed with sleep disorders nowadays. Sleep disruption in children can lead to poor mental health in the long term. The present study aimed to evaluate the association between sleep disorders and subsequent depression in children and adolescents. This retrospective cohort study used electronic medical records from the IQVIATM Disease Analyzer database. It included children and adolescents aged 6-16 with an initial diagnosis of a sleep disorder and age- and gender-matched patients without sleep disorders treated by one of 274 office-based pediatricians in Germany between January 2010 and December 2022. The five-year cumulative incidence of depression in the cohorts with and without sleep disorders was studied with Kaplan-Meier curves using the log-rank test. Multivariable Cox regression analyses were used to assess the association between sleep disorders and depression. The present study included 10,466 children and adolescents with and 52,330 without sleep disorder diagnosis (mean age 10 ± 3 years, 48% female). Within five years after the index date, 5% of sleep disorder patients and 2% of the matched non-sleep disorder cohort had been diagnosed with depression. A strong and significant association was observed between sleep disorders and subsequent depression (HR: 2.34; 95% CI: 2.09-2.63). This association was stronger in adolescents (HR: 3.78; 95% CI: 3.13-4.56) than in children. Upon the exclusion of depression diagnoses in the first year after the index date, the association between sleep disorders and depression remained strong and significant (HR: 1.92; 95% CI: 1.68-2.19). This study indicates a strong and significant association between sleep disorders and depression.