An increase in renewable energy sources and a subsequent need for more energy-efficient construction practices have prompted efforts to optimize energy distribution networks. Various building types, including residential, hotel, and hospital structures, may benefit from solar-based integrated energy systems (SIES) that include energy-sharing mechanisms and Effective Thermal Storage Systems (ETSS). This new approach is presented in the present research. In this paper a new optimization model is proposed that consider the correlation of energy storage system with fluctuating load demands of the building (BL). This theology makes it possible for any building with high energy demand in the day to trade excess power with another building which has low demand during the same time. From the simulation we get that grid power consumption is reduced from homes by 15%, hotels by 12% and hospitals by 18% through use of energy-sharing and Energy Transfer System (ETSS). Efficient energy redistribution management also helps increase the consumption of renewable resources by 20%. The proposed method led to a cumulative increase in the overall efficiency by 12% compared to the control strategy by optimizing the energy supply and demand in various sorts of buildings. Comparing our method with the previous work clearly shows that using the proposed approach yields better energy saving and higher usage of renewable energy sources because the method takes into consideration building plan and load profile. These results serve as a foundation for integrated energy systems of a smart city solution that incorporates ETSS and energy sharing.