BACKGROUNDThe acceleration of aging and the increase in life expectancy have resulted in an increasing number of older adults developing physical and mental comorbidities. We examined the association between depression and quality of life (QoL) using cognitive impairment (COI) as a mediator and sleep quality (SQ) as a moderator among older adults with type 2 diabetes.METHODSA total of 2646 participants from Weifang, Shandong, China completed the survey. Their depression, cognitive function, SQ, and QoL were assessed. PROCESS was used to investigate mediating and moderating effects.RESULTSCOI mediated the association between depression and QoL (indirect effect = -0.1058, bootstrapped 95 % CI [-0.1417, -0.0725]). Moderated mediation analyses indicated that SQ moderated the first half of the pathway of depression's impact on QoL through COI (moderating effect = -0.1128, bootstrapped 95 % CI [-0.1981, -0.0348]). Depression negatively impacted cognitive function in participants with poor (vs. better) SQ.LIMITATIONSFirst, multiple assessment tools should be considered to increase objective assessment. Second, the cross-sectional design limited our ability to make causal inferences. Third, additional diabetes-related variables should be included to explore this relationship. Finally, the pathways of influence and mechanisms of action of COI in older adults should be explored further.CONCLUSIONDepression could impair the QoL of older adults by aggravating their COI. Fortunately, improving patients' SQ may undermine this negative effect. These findings may play an integral role in promoting the psychiatric health of older adults with type 2 diabetes.