Disturbed sleep is common in chronic obstructive pulmonary disease (COPD). Conventional hypnotics worsen nocturnal hypoxemia and, in severe cases, can lead to respiratory failure. Exogenous melatonin has somnogenic properties in normal subjects and can improve sleep in several clinical conditions. This randomized, double-blind, placebo-controlled study was carried out to determine the effects of melatonin on sleep in COPD. Thirty consecutive patients with moderate to very severe COPD were initially recruited for the study. None of the participants had a history of disease exacerbation 4 weeks prior to the study, obstructive sleep apnea, mental disorders, current use of oral steroids, methylxanthines or hypnotic-sedative medication, nocturnal oxygen therapy, and shift work. Patients received 3 mg melatonin (N = 12) or placebo (N = 13), orally in a single dose, 1 h before bedtime for 21 consecutive days. Sleep quality was assessed by the Pittsburgh Sleep Quality Index (PSQI) and daytime sleepiness was measured by the Epworth Sleepiness Scale. Pulmonary function and functional exercise level were assessed by spirometry and the 6-min walk test, respectively. Twenty-five patients completed the study protocol and were included in the final analysis. Melatonin treatment significantly improved global PSQI scores (P = 0.012), particularly sleep latency (P = 0.008) and sleep duration (P = 0.046). No differences in daytime sleepiness, lung function and functional exercise level were observed. We conclude that melatonin can improve sleep in COPD. Further long-term studies involving larger number of patients are needed before melatonin can be safely recommended for the management of sleep disturbances in these patients.