BackgroundAs opposed to a healthy lifestyle, indoor air pollution from solid fuel use may be harmful for cognitive function. However, the extent to which lifestyle modifies the association between solid fuel use and cognitive function remains unknown. MethodsA total of 21,008 individuals aged 16 to 92 were enrolled in 2010 and followed up to 2014 in the China Family Panel Studies (CFPS). Cognitive function was assessed using standardized math and word tests in two waves. Solid fuel use at baseline was assessed by self-reporting of firewood, straw, or coal used for cooking. Lifestyle profile was classified into two groups (favorable vs. unfavorable) based on five modifiable lifestyle factors including alcohol drinking, smoking, body mass index, diet, and physical activity. Linear mixed-effects models were employed to assess the association of solid fuel use and lifestyle with cognitive function. The effect modification of lifestyle was analyzed. ResultsA total of 49.7% of the study population used solid fuels for cooking and 17.4% had a favorable lifestyle. Solid fuel use was associated with a significant decrease in cognitive function (β = −0.29, 95% CI: −0.39, −0.19 for math test; β = −0.62, 95% CI: −0.84, −0.41 for word test). Lifestyle significantly modified this association (p-interaction: 0.006 for math test; 0.016 for word test), with the corresponding association being less pronounced among participants adhering to a favorable lifestyle compared to those with an unfavorable lifestyle. ConclusionA favorable lifestyle may attenuate the adverse association between solid fuel use and cognitive function. Adopting a favorable lifestyle has the potential to mitigate the adverse neurological effects due to indoor air pollution.