A peer‐to‐peer (P2P) network is defined as a distributed network in which nodes with similar characteristics exchange data with others. Efficient data sharing in P2P systems is essentially faced with challenges due to uncertainties of erratic node failures and unreliable network connectivity. Data replication on multiple nodes can improve availability and alleviate latency. However, the number of created replicas and the corresponding location of these replicas need to be determined optimally. In this paper, a novel framework for data replication is proposed in P2P networks, in which optimal allocations are achieved based on the two objectives including the minimisation of delay and maximisation of hit rate of queries. The proposed model finds allocations that specify the number and location of each replica of existing files in the network based on two considered objectives. A multi‐objective technique based on the Non‐Dominated Sorting Genetic Algorithm II (NSGA‐II) algorithm is utilised to solve the proposed model and to extract non‐dominated Pareto‐optimal solutions of the allocations. Finally, one of the allocations of the obtained Pareto optimal set is applied to the network and the delay and hit rate of queries pertaining to this situation is compared with two models: i) initial model of the network, that is, the state where there is no replica of the files except the original version of the file, and ii) the random replication model to verify the efficiency of the presented method. All simulations in this paper have been done using C++ programming language.