To investigate correlation between cognitive function, age, and sleep disturbances. This retrospective clinical study enrolled 78 patients with sleep disorders who were divided into three groups: a group of 24 patients with sleep disorders accompanied by cognitive decline (SD-CD); 54 patients with sleep disorders and no cognitive decline (SD-nCD) was divided into two groups, one of 30 patients aged between 60 and 70 years and another of 24 patients aged >70 years. Polysomnography was used to record patients' sleep indicators throughout night; these included total sleep duration, sleep efficiency (SE), sleep latency, sleep structure and percentage of N1, N2, and N3 stages, rapid eye movement (REM) stage, as well as apnea hypopnea index (AHI), and oxygen saturation (OS). Analysis of variance (ANOVA) for continuous variables and chi-square test for categorical variables were used to analyze variables between different groups. Pearson's correlation was used to analyze correlation between sleep parameters and mini-mental state examination (MMSE). Blood samples were used to determine their Aβ, Aβ40, Aβ42, total tau, phosphorylated tau protein (ptau), ptau181, ptau217, the inflammatory factor IL-1β, vitamin B12 (VB12), and melatonin levels. In the SD-CD group, there was a significant decrease in SE and an increase in N1 stage sleep in older patients and a significant increase in AHI, REM stage AHI, and non-REM stage AHI. In patients with SD-nCD, the minimum OS, minimum OS in the REM period, and minimum OS in the non-REM period were significantly reduced. OS was significantly correlated with cognitive level, as evaluated by the MMSE. The addition of sleep parameters can significantly improve the accuracy of dementia diagnosis. Dementia biomarkers of Aβ and tau proteins in blood showed cognition-related differences, while ptau181 was associated with both cognition and age-related differences. Regression models revealed that age was related to higher levels of cognitive decline before (β = -0.43, P < 0.001) and after (β = -0.38, P < 0.001) adjustment of gender, BMI, and education level. There was a significant mediation effect of relationship between aging and cognitive function by sleep efficiency and N1 stage sleep. Sleep disorders and low OS are associated with a higher incidence of cognitive decline and dementia.