In this paper, an optimisation approach to prioritise buyers and sellers in a peer-to-peer (P2P) energy trading market based on distances from the aggregator has been developed. The proposed approach assigns higher preferences to buyers/sellers with a smaller distance, as this will allow lower losses in the power transmission. Under this approach, the sellers and buyers operate in a decentralised manner to optimise the preference coefficients along with the energy sold/purchased to achieve certain profits/savings. The proposed approach is implemented using a real-life dataset, and the impacts of different parameters, such as seasonal variations in renewable generation, distances and profit thresholds for sellers, have been investigated. The results show that the proposed approach allows buyers and sellers to purchase/sell more energy from the P2P trading market (2.4 times increase when maximum energy sold is considered) in comparison to the case when all participants are equally preferred. It has been observed that, with increasing distances, sellers are assigned a smaller preference coefficient, which results in sellers being willing to sell a higher amount of energy so that they can achieve the same profit threshold.