Proper cognitive functions are critical to the life of the elderly. With the rapid aging of the population, community support plays an important role in cognitive functioning. This study examines the association between community support and the level of cognitive functioning in the elderly, and the mediating effect of social participation in the relationship. Based on the panel data of China Longitudinal Healthy Longevity Survey (CLHLS) in 2005, 2008, 2011, 2014, and 2018, people aged 65 and over are selected as the research object (N = 35,479). The panel Logit model is used to analyze the influence of community support on their cognitive functioning. In addition, the stepwise regression and KHB decomposition methods are used to test the influence mechanism of community support on their cognitive function. The benchmark regression results show that there is a significant correlation between community support and cognitive function in the elderly (OR: 1.64, 95% CI: 1.41–1.91, p