The mitigation of negative environmental impacts and the socioeconomic benefits associated with renewable energy systems encourage greater incorporation of distributed energy systems into conventional power grids. A novel form of the sharing economy is emerging, involving the shared use of energy resources to lower transaction costs via cloud-based platform services. In light of challenges arising from outdated infrastructure and diverse approaches to renewable energy integration, Distributed Energy and Micro Grids (DE-MG) represent an effective solution to enhance the quality of energy supply services. However, constraints related to microgrid scalability, budget adherence, and security can complicate implementation. Consumers achieve more favorable pricing for renewable energy allocation via cloud-based Peer-to-Peer (P2P) networks. The core goal is to minimize the daily energy expenditure for microgrid power in commercial buildings. In the proposed approach, cloud-based P2P combined with peer-Multi-Agent System (p-MAS) optimization methods is employed to reduce system peak loads and to integrate Demand Response (DR) with an Energy Management System (EMS) within a commercial MG. To address gaps in understanding how different power market structures and individual decision-making behaviors influence local interactions and overall market results, cloud-based P2P for Modeling Leveraging Agents (MLA) is applied to perform bill calculations. Finally, a performance metric is developed to assess cost and reliability, enabling evaluation of the societal benefits of cloud-based P2P energy exchange models. Comparisons are presented between the proposed cloud-based P2P model and an existing P2P energy exchange model across various pricing scenarios and resource categories. The key application of a distributed P2P model for power trading in a microgrid is to reduce electricity costs while improving the grid’s environmental reliability.