Methylenedioxymethamphetamine (MDMA; "Ecstasy") is a popular recreational drug and brain serotonin (5-HT) neurotoxin. Neuroimaging data indicate that some human MDMA users develop persistent deficits in brain 5-HT neuronal markers. Although the consequences of MDMA-induced 5-HT neurotoxicity are not fully understood, abstinent MDMA users have been found to have subtle cognitive deficits and altered sleep architecture. The present study sought to test the hypothesis that sleep disturbance plays a role in cognitive deficits in MDMA users. Nineteen abstinent MDMA users and 21 control subjects participated in a 5 d inpatient study in a clinical research unit. Baseline sleep quality was measured using the Pittsburgh Sleep Quality Inventory. Cognitive performance was tested three times daily using a computerized cognitive battery. On the third day of admission, subjects began a 40 h sleep deprivation period and continued cognitive testing using the same daily schedule. At baseline, MDMA users performed less accurately than controls on a task of working memory and more impulsively on four of the seven computerized tests. During sleep deprivation, MDMA users, but not controls, became increasingly impulsive, performing more rapidly at the expense of accuracy on tasks of working and short-term memory. Tests of mediation implicated baseline sleep disturbance in the cognitive decline seen during sleep deprivation. These findings are the first to demonstrate that memory problems in MDMA users may be related, at least in part, to sleep disturbance and suggest that cognitive deficits in MDMA users may become more prominent in situations associated with sleep deprivation.