BACKGROUND: Short and long sleep duration have been linked with poorer cognitive outcomes, but it remains unclear whether these associations are causal. METHODS: We conducted the first Mendelian randomization (MR) study with 77 single-nucleotide polymorphisms (SNPs) for sleep duration using individual-participant data from the UK Biobank cohort (N = 395 803) and summary statistics from the International Genomics of Alzheimer’s Project (N cases/controls = 17 008/37 154) to investigate the potential impact of sleep duration on cognitive outcomes. RESULTS: Linear MR suggested that each additional hour/day of sleep was associated with 1% [95% confidence interval (CI) = 0-2%; P = 0.008] slower reaction time and 3% more errors in visual-memory test (95% CI = 0-6%; P = 0.05). There was little evidence to support associations of increased sleep duration with decline in visual memory [odds ratio (OR) per additional hour/day of sleep = 1.10 (95% CI = 0.76-1.57); P = 0.62], decline in reaction time [OR = 1.28 (95% CI = 0.49-3.35); P = 0.61], all-cause dementia [OR = 1.19 (95% CI = 0.65-2.19); P = 0.57] or Alzheimer’s disease risk [OR = 0.89 (95% CI = 0.67-1.18); P = 0.41]. Non-linear MR suggested that both short and long sleep duration were associated with poorer visual memory (P for non-linearity = 3.44e-9) and reaction time (P for non-linearity = 6.66e-16). CONCLUSIONS: Linear increase in sleep duration has a small negative effect on reaction time and visual memory, but the true association might be non-linear, with evidence of associations for both short and long sleep duration. These findings suggest that sleep duration may represent a potential causal pathway for cognition.