Depression is a common mental disorder in middle-aged and elderly people, which seriously affects their physical health and life quality.So far, whether pulmonary function is a factor in depression has not been tested.The purpose of this study was to test whether pulmonary function was independently associated with depression and to assess the effects of cognitive ability and sleep time on this association.In this analysis, 5,235 participants from the Chinese Longitudinal Study of Health and Retirement were included. Participants were registered in 2015 and followed up in 2018. The relationship between pulmonary function and depression was estimated by binary logistic regression model. The mediated role of cognitive ability was examined by intermediary analysis, and the interaction between pulmonary function and sleep time on depression was discussed.After adjusting for confounding factors, it was found that higher baseline pulmonary function was the protective factor of depression (OR [95%CI]=0.524 [0.394-0.697] for the lowest quantile vs the highest quantile). Cognitive ability explained 14.55% of the association between pulmonary function and depression, pulmonary function and sleep time on the effects of depression have a combined interaction, RERI (95%CI) = 0.545 (0.053-1.038).High baseline pulmonary function is independently associated with a lower risk of depression, which is partly mediated by cognitive ability. Pulmonary function and sleep time have synergy with the effects of depression. These findings show that pulmonary function, cognitive ability and sleep time are reliable predictors of depression.