To establish the efficacy of melatonin treatment in childhood sleep onset insomnia, 40 elementary school children, 6 to 12 years of age, who suffered more than 1 year from chronic sleep onset insomnia, were studied in a double-blind, placebo-controlled study. The children were randomly assigned to receive either 5-mg melatonin or placebo. The study consisted of a 1-week baseline, consecutively followed by a 4-week treatment period. After that period, treatment was continued if the parents wished so. The study's impact was assessed by measurements of lights-off time, sleep onset, and wake-up time, recorded in a diary (n = 33). Sleep onset was also recorded with an actigraph (n = 25). Endogenous dim light melatonin onset was measured in saliva (n = 27). Sustained attention was evaluated with the Bourdon-Vos reaction time test (n = 36). In the melatonin group, mean (95% CI) lights-off time advanced 34 (6-63) minutes, diary sleep onset 63 (32-94) minutes, actigraphic sleep onset 75 (36-114) minutes, and melatonin onset 57 (24 to 89) minutes; total sleep time increased 41 (19-62) minutes. In the placebo group, these parameters did not shift significantly. The change during the 4-week treatment period differed between the treatment groups significantly as to lights-off time, diary and actigraphic sleep onset, sleep duration, and melatonin onset. There were no significant differences between the treatment groups in the change of sleep latency, wake-up time, and sustained attention reaction times. Mild headache occurred in 2 children during the first 2 days of the melatonin treatment. Eighteen months after the start of the trial, in 13 of the 38 children who could be followed up, melatonin treatment was stopped because their sleep problem was solved and in 1 child because sleep was not improved. Twelve children used melatonin 5 mg, the other 1.0 to 2.5 mg. One child developed mild generalized epilepsy 4 months after the start of the trial. The results show that melatonin, 5 mg at 6 PM, was relatively safe to take in the short term and significantly more effective than placebo in advancing sleep onset and dim light melatonin onset and increasing sleep duration in elementary school children with chronic sleep onset insomnia. Sustained attention was not affected.