BackgroundCardiovascular disease (CVD) caused by air pollution poses a considerable burden on public health. We aim to examine whether lifestyle factors mediate the associations of air pollutant exposure with the risk of CVD and the extent of the interaction between lifestyles and air pollutant exposure regarding CVD outcomes.MethodsWe included 7000 participants in 2011–2012 and followed up until 2018. The lifestyle evaluation consists of six factors as proxies, including blood pressure, blood glucose, blood lipids, body mass index, tobacco exposure, and physical activity, and the participants were categorized into three lifestyle groups according to the number of ideal factors (unfavorable, 0–1; intermediate, 2–4; and favorable, 5–6). Satellite-based spatiotemporal models were used to estimate exposure to ambient air pollutants (including particles with diameters ≤ 1.0 μm [PM1], ≤ 2.5 μm [PM2.5], ≤ 10 μm [PM10], nitrogen dioxide [NO2], and ozone [O3]). Cox regression models were used to examine the associations between air pollutant exposure, lifestyles and the risk of CVD. The mediation and modification effects of lifestyle categories on the association between air pollutant exposure and CVD were analyzed.ResultsAfter adjusting for covariates, per 10 μg/m3 increase in exposure to PM1 (HR: 1.09, 95% CI: 1.05–1.14), PM2.5 (HR: 1.04, 95% CI: 1.00–1.08), PM10 (HR: 1.05, 95% CI: 1.03–1.08), and NO2 (HR: 1.11, 95% CI: 1.05–1.18) was associated with an increased risk of CVD. Adherence to a healthy lifestyle was associated with a reduced risk of CVD compared to an unfavorable lifestyle (HR: 0.65, 95% CI: 0.56–0.76 for intermediate lifestyle and HR: 0.41, 95% CI: 0.32–0.53 for favorable lifestyle). Lifestyle played a significant partial mediating role in the contribution of air pollutant exposure to CVD, with the mediation proportion ranging from 7.4% for PM10 to 14.3% for PM2.5. Compared to an unfavorable lifestyle, the relative excess risk due to interaction for a healthier lifestyle to reduce the effect on CVD risk was − 0.98 (− 1.52 to − 0.44) for PM1, − 0.60 (− 1.05 to − 0.14) for PM2.5, − 1.84 (− 2.59 to − 1.09) for PM10, − 1.44 (− 2.10 to − 0.79) for NO2, and − 0.60 (− 1.08, − 0.12) for O3.ConclusionsLifestyle partially mediated the association of air pollution with CVD, and adherence to a healthy lifestyle could protect middle-aged and elderly people from the adverse effects of air pollution regarding CVD.