Sleep disturbances are common in the pediatric population and should primarily be treated non-pharmacologically. Most medicines for sleep disturbances are not approved for pediatric use and data on long-term safety is scarce. In Sweden, melatonin is classified as a prescription medicine. The aim of the present study was to characterize the prevalence and incidence of dispensed melatonin prescriptions, long-term treatment, concomitant dispensation of psychotropic medication, and psychiatric comorbidity, in children and adolescents aged 0-17 years living in Sweden during 2006-2017. Data was retrieved by linking the national population-based registers, the Swedish Prescribed Drug register and the National Patient register. In 2017, nearly 2% of the pediatric population 0-17 years was dispensed at least one prescription of melatonin, which was more than a 15-fold increase for girls and a 20-fold increase for boys, when compared to 2006. Among the children in the age group 5-9 who initiated a melatonin treatment in 2009, 15% of girls and 17% of boys were found to be continuously prescribed melatonin 8 years later. Nearly 80% of all children with dispensed melatonin had concomitant dispensations of psychotropic medications. The most common combination was melatonin together with centrally acting sympathomimetic medicines (23% of girls and 43% of boys). About half of the children (47% of girls and 50% of boys) had at least one registered diagnosis of mental or behavioral disorders. The most common diagnosis was attention deficit hyperactive disorder, across all age groups and genders. The continuous increase of use of melatonin in children, often concomitant with other psychotropic medications, together with a high proportion of younger children with prescriptions of melatonin on a long-term basis, suggests the need for further structured follow up studies, in particular of long-term use.