BackgroundThe associations of sleep duration and depressive status on cognitive function among the elderly remain controversial. This study aimed to investigate the associative effects and mediating mechanisms between sleep duration and depressive status on cognitive function in elderly adults. MethodsParticipants were recruited from cross-sectional and cohort surveys of the Chinese Longitudinal Healthy Longevity Survey (CLHLS). We identified thresholds for sleep duration and depression and used logistic regression to explore their independent and joint effects on cognitive impairment. Further, we analyze the mediating effects of depressive status on the association between sleep duration and cognitive function. ResultsOf 13840 elderly (median age: 84 years, female: 54.6 %), 2835 (20.5 %) had cognitive impairment. Compared with those who slept 6–8 h, the ORs (95%CIs) for those who slept < 6 h and > 8 h were 0.98 (0.85, 1.12) and 1.48 (1.32, 1.66). Compared with non-depressed, the OR (95%CI) for the depressed participants was 1.74 (1.53, 1.98). Compared with those with sleep 6–8 h and none-depression, those with sleep > 8 h and depression had the highest odds of cognitive impairment (OR = 2.40, 95%CI: 1.88–3.07). Additionally, Compared with those who slept 6–8 h, the associations between depression-mediated short and long sleep and cognitive impairment were 51.1 % and 6.5 %, respectively. LimitationsCross-sectional studies require caution in the interpretation of causal associations. ConclusionsLong sleep and depression were independently and jointly associated with higher odds of cognitive impairment among the Chinese elderly, and short sleep increased the risk of cognitive impairment by promoting the prevalence of depression.