The penetration of distributed energy resources (DERs) has changed the role of a consumer to a prosumer, i.e., producer and consumer. This new role provides the opportunity for peer-to-peer(P2P) energy trading. In this paper, a three-stage iterative framework is proposed to clear the price and quantity of trading in P2P markets while addressing price and DER uncertainties by the Monte Carlo simulation (MCS) method. Initially, bids and offers of customers are determined by implementing an advanced satisfaction-based home energy management system (HEMS) at each home. Subsequently, the market operator prioritizes bids and offers according to the amount of customers' participation in the market. Finally, the P2P market is cleared by application of the alternating direction method of multipliers (ADMM), and the market clearing prices (MCPs) are determined. MCPs are used as a parameter to repeat the three stages, and the procedure is redone until the stopping rule is met. The proposed method's effectiveness has been investigated in communities with 8, 50, and 100 prosumers. Results indicate a 69.51 % cost reduction in a smart energy community with 50 homes through P2P energy market participation. The proposed market clearing method is compared with the common mid-market rate (MMR) and Stackelberg game methods and demonstrates over 25 % reduction in community costs.