ObjectivesSleep is an indispensable part of human health, which can help us to restore physical strength, enhance immunity and maintain nervous system stability. The relationship between sleep quality and cognitive dysfunction is unclear, especially at the community population level. This study aims to explore the association between sleep quality and cognitive dysfunction.MethodsA total of 5,224 community residents were enrolled in this cross-sectional study. Cognitive function was assessed by the Mini-Mental State Examination (MMSE). Sleep quality was assessed by the multidimensional sleep questionnaire. Multivariate logistic regression was used to analyze the association between sleep quality and cognitive dysfunction. The adjusted models took into account relevant demographic, clinical, and sleep variables.ResultsA total of 3,106 participants were enrolled in this study, of whom 463 (15%) had cognitive dysfunction. Total sleep duration, staying up, sleep latency, number of awakenings, and history of sleep medications were associated with cognitive dysfunction in unadjusted models, and these effects were consistent after adjustment. First, those who slept 6–7.9 h per day (OR = 0.57, 95% CI 0.40 to 0.80, p = 0.001) had a lower risk for cognitive dysfunction compared to those who slept less than 6 h per day. Second, participants who stayed up more than 10 times over the 3 months (OR = 1.90, 95% CI 1.20 to 3.00, p = 0.006) were more likely to suffer cognitive dysfunction than those who never stayed up. Third, we also found that participants with sleep latencies of 16–30 min were less likely to experience cognitive dysfunction than those with sleep latencies of less than 16 min after adjusting confounders (OR = 0.33, 95% CI 0.23 to 0.47, p < 0.001). Fourth, participants who woke up once (OR = 1.65, 95% CI 1.19 to 2.30, p = 0.003) and three or more times (OR = 2.34, 95% CI 1.25 to 4.36, p = 0.008) after falling asleep had a higher risk than those who did not wake up at night. Last, participants taking sleep medication (OR = 2.97, 95% CI 1.19 to 7.45, p = 0.020) were more vulnerable to cognitive dysfunction, relative to participants without taking any medications.ConclusionOur results suggest that after adjustment for potential confounding variables, poor sleep quality is associated with cognitive dysfunction.