Objective: To analyze the association between sleep duration and cognitive function of the elderly in six provinces of China. Methods: Based on the cross-sectional survey data of the elderly from the Healthy Ageing Assessment Cohort Study in 2019, 4 644 participants' sociodemographic and economic indicators, lifestyle, prevalence of major chronic diseases, and sleep status, including night-time sleep duration, daytime sleep duration and insomnia, were collected by questionnaires. Cognitive function was evaluated by the Mini-Mental State Examination. Multivariate logistic regression was used to analyze the association between night-time sleep duration, daytime sleep duration and cognitive function. Results: The mean age of 4 644 respondents was (72.3±5.7) years, and 2 111 of them were males (45.5%). The mean total daily sleep time of the elderly was (7.9±1.9) hours, and the proportion of those who slept less than 7.0, 7.0-8.9 and≥9.0 hours was 24.1% (1 119), 42.1% (1 954) and 33.8% (1 571), respectively. The mean sleep time at night was (6.9±1.7) hours. About 23.7% (1 102) of the elderly did not sleep during the day, and the mean duration of the elderly who slept during the day was (78±51) minutes. Among the elderly with insomnia, 47.9% were still satisfied with their sleep quality. The mean value of MMSE score of 4 644 respondents was (24.5±5.3), and the cognitive impairment rate was 28.3% (1 316). The results of multivariate logistic regression model analysis showed that the OR (95%CI) value of the risk of cognitive impairment in older people who did not sleep, slept for 31 to 60 minutes and slept more than one hour was 1.473 (1.139 to 1.904), 1.277 (1.001 to 1.629) and 1.496 (1.160 to 1.928), respectively, compared with those who slept for 1 to 30 minutes during the daytime. Compared with those who slept for 7.0‒8.9 hours at night, the OR (95%CI) value of the risk of cognitive impairment in older people who slept more than 9.0 hours was 1.239 (1.011 to 1.519). Conclusion: The cognitive function is related to sleep duration in the Chinese elderly.