SummaryUnstructured peer‐to‐peer (P2P) networks pose unique challenges for efficient and scalable routing. In this study, we introduce a novel routing algorithm inspired by the foraging behavior of honey bees named Honey Bee Optimization in P2P Networks (HBO_P2P) to address the inherent limitations of routing in unstructured P2P networks, focusing on improving packet delivery, minimizing hop count, reducing message overhead, and optimizing overall throughput. To evaluate the performance of our proposed algorithm, we conducted comprehensive experiments comparing it with existing algorithms commonly used in P2P networks, namely, particle swarm optimization (PSO), genetic algorithm (GA), and ant colony optimization (ACO). After the simulation, we got the results as follows: Our algorithm outperforms ACO, GA, and PSO by exhibiting the highest number of data hops indicating potential efficiency in route optimization. Routing overhead is also minimal as compared to ACO, GA, and PSO. The average data packet delay is also low in our algorithm as compared to ACO, GA, and PSO. HBO_P2P achieves the highest throughput, nearly reaching 100 Mbps. While ACO and GA exhibit similar throughput of around 80 Mbps, and PSO has the lowest throughput, approximately 60 Mbps.