SummaryBackgroundType 2 diabetes increases the risk for dementia, but whether it affects cognition before old age is unclear. We investigated whether duration of diabetes in late midlife and poor glycaemic control were associated with accelerated cognitive decline.Methods5653 participants from the Whitehall II cohort study (median age 54·4 years [IQR 50·3–60·3] at first cognitive assessment), were classified into four groups: normoglycaemia, prediabetes, newly diagnosed diabetes, and known diabetes. Tests of memory, reasoning, phonemic and semantic fluency, and a global score that combined all cognitive tests, were assessed three times over 10 years (1997–99, 2002–04, and 2007–09). Mean HbA1c was used to assess glycaemic control during follow-up. Analyses were adjusted for sociodemographic characteristics, health-related behaviours, and chronic diseases.FindingsCompared with normoglycaemic participants, those with known diabetes had a 45% faster decline in memory (10 year difference in decline −0·13 SD, 95% CI −0·26 to −0·00; p=0·046), a 29% faster decline in reasoning (−0·10 SD, −0·19 to −0·01; p=0·026), and a 24% faster decline in the global cognitive score (−0·11 SD, −0·21 to −0·02; p=0·014). Participants with prediabetes or newly diagnosed diabetes had similar rates of decline to those with normoglycaemia. Poorer glycaemic control in participants with known diabetes was associated with a significantly faster decline in memory (−0·12 [–0·22 to −0·01]; p=0·034) and a decline in reasoning that approached significance (−0·07 [–0·15 to 0·00]; p=0·052).InterpretationThe risk of accelerated cognitive decline in middle-aged patients with type 2 diabetes is dependent on both disease duration and glycaemic control.FundingUS National Institutes of Health, UK Medical Research Council.