This paper proposes an adaptive segmentation method as a market clearing mechanism for peer-to-peer (P2P) energy trading scheme with large number of market players. In the proposed method, market players participate in the market by announcing their bids. In the first step, players are assigned to different segments based on their features, where the balanced k-means clustering method is implemented to form segments. These segments are formed based on the similarity between players, where the amount of energy for trade and its corresponding price are considered as features of players. In the next step, a distributed method is employed to clear the market in each segment without any need to private information of players. The novelty of this paper relies on developing an adaptive algorithm for dividing large number of market players into multiple segments to enhance scalability of the P2P trading by reducing data exchange and communication overheads. The proposed approach can be used along with any distributed method for market clearing. In this paper, two different structures including community-based market and decentralized bilateral trading market are used to demonstrate the efficacy of the proposed method. Simulation results show the beneficial properties of the proposed segmentation method.