Background: Methylphenidate may improve executive functioning in children with attention-deficit/hyperactivity disorder (ADHD). However, it is unclear if there are still acute effects of methylphenidate on executive functioning after long-term use. Methods: In a randomized double-blind, placebo-controlled discontinuation study, 94 children and adolescents (ages 8-18 years) who used methylphenidate beyond two years were either assigned to seven weeks of continued treatment with 36 or 54 mg of extended-release methylphenidate or to gradual withdrawal over three weeks to placebo for four weeks. Performance on neuropsychological tasks, measuring working memory, response inhibition, attentional flexibility and psychomotor speed was compared between both groups using mixed models for repeated measures. Additionally, we investigated within the discontinuation group if a deterioration on the investigator-rated Clinical Global Impressions Improvement scale after withdrawing to placebo was related to a worse performance on the neuropsychological tasks. This study was registered in the Netherlands Trial Register (www. Trialregister.nl) with identifier 5252. Results: After withdrawal of methylphenidate, the discontinuation group made more errors on working memory (b = À1.62, SD = 0.56, t = À2.88, p = .01, Cohen's f2 = .14), independent from reaction time compared to baseline, in contrast to the continuation group. We did not find differences in changes in response inhibition, attentional flexibility and psychomotor speed between the two groups. Also, there were no significant differences in task measures between the participants who deteriorated clinically and those who did not. Conclusions: Our study shows that methylphenidate has a beneficial effect on working memory after two years of use. Future studies should explore whether cognitive outcomes may aid clinical decision-making on the continued use of methylphenidate, given dissociation between cognitive and behavioural effects of stimulant medication.