Numerous countries attempt to mitigate air pollution by transitioning from fossil to clean energy since the large-scale burning of fossil fuels has triggered an environmental crisis. However, the effects of of these effort remain mixed. This study investigates the environmental benefits of China's coal-to-gas (CTG) policy utilizing monthly data and the difference-in-difference (DID) model. The results indicate that the CTG policy can reduce individual air pollution by 6.16%∼12.41%, AQI by 1.76%, whereas increase ozone by 11.85%. Moreover, the benefits are more prominent in the spring and winter, resource-based cities, megacities, and cities with young leaders and strong governance. Nevertheless, CTG ultimately confronts the risk of policy failure in the long run. While the rebound effect can worsen air quality, structural optimization and technological innovation can mitigate air pollution. Further, the cost-benefit analysis indicates that the benefits of CTG can roughly cover its costs, but its cost-benefit efficiency is low. Our findings clarify the debate between CTG and air pollution on larger and higher-resolution datasets and provide strong empirical support for policymakers to achieve sustainable development through deep energy structure adjustment. We propose targeted policy implications on the design of collaborative emission reduction tools and subsidy fairness.