The optimal design of distributed generation systems is of foremost importance to reduce fossil fuel consumption and mitigate the environmental impact of human activities in urban areas. Moreover, an efficient and integrated control strategy is needed for each of the components of a distributed generation plant, in order to reach the expected economic and environmental performances.In this paper, the transition from natural gas to electricity-based heating is evaluated for residential applications, considering the interplay between photovoltaic electricity produced on site and the thermal energy storage, to grant the optimal management of heating devices. The energy demand of an apartment building, under different climatic conditions, is taken as a reference and four power plant solutions are assessed in terms of energy cost and pollution reduction potential, compared to a baseline plant configuration. The performance of each power plant is analyzed assuming an optimized control strategy, which is determined through a graph-based methodology that was previously developed and validated by the authors. Outcomes from our study show that, if heat pumps are used instead of natural gas boilers, energy costs can be reduced up to 41%, while CO 2 emissions can be reduced up to 73%, depending on the climatic conditions.Our results provide a sound basis for considering the larger penetration of photovoltaic plants as an effective solution towards cleaner and more efficient heating technologies for civil applications. The simultaneous utilization of heat pumps (as substitutes of boilers) and photovoltaic panels yields a positive synergy that nullifies the local pollution, drastically cuts the CO 2 emission, and guarantees the economical sustainability of the investment in renewable energy sources without subsidiary mechanisms.