Abstract Introduction Growing evidence suggests that sleep disturbance might be a risk factor for cognitive impairment in older adults. However, the association between device-based sleep duration, quality and cognitive function in midlife is poorly understood. Methods We examined 526 Black and White men and women who completed the sleep examination at baseline from 2003 to 2005 and had cognition evaluated 11 years later from the Coronary Artery Risk Development in Young Adults (CARDIA) study, Sleep duration and quality was assessed objectively using a wrist activity monitor and subjectively by Pittsburgh Sleep Quality Index (PSQI). We evaluated cognitive function using the Digit Symbol Substitution Test (DSST), Stroop test, Rey Auditory Verbal Learning Test (RAVLT), Montreal Cognitive Assessment (MoCA) and Letter Fluency and Category Fluency tests. Results This study included 305 (58%) women and 229 (44%) Black people, with a mean age of 40.1±3.6 years at baseline. After adjustment for age, sex, race, education, smoking, body mass index, depression, physical activity, hypertension and diabetes, actigraphy-measured sleep fragmentation index (calculated as the sum of the percentage of time spent moving and the percentage of immobile periods ≤ 1 minute) was significantly associated with all measures of cognition, except for fluency. Every standard deviation increase in sleep fragmentation index was associated with worse executive function [DSST (b=-1.80, 95%CI: -3.20, -0.41) and Stroop (b=-1.23, -0.25, -2.21)], worse verbal learning [RAVLT (b=-0.41, 95%CI: -0.66, -0.82)] and worse global cognition [MOCA (b=-0.41, 95%CI: -0.74, -0.16)]. Poorer sleep maintenance was associated with worse verbal learning (RAVLT) and global cognition (MOCA) of a similar magnitude. We did not find any association between objective sleep duration or subjective sleep quality and cognition. Conclusion Poorer actigraphy-measured sleep quality rather than sleep duration was associated with worse executive function, verbal learning and global cognition among middle-aged Black and White men and women. Sleep quality is important for cognitive health in midlife. Support (If Any)