This paper presents NN_ILEACH, a novel neural network-based routing protocol designed to enhance the energy efficiency and longevity of Wireless Sensor Networks (WSNs). By integrating the Energy Hole Removing Mechanism (EHORM) with a sophisticated neural network for cluster head selection, NN_ILEACH effectively addresses the energy depletion challenges associated with traditional protocols like LEACH and ILEACH. Our extensive simulations demonstrate that NN_ILEACH significantly outperforms these classical protocols. Specifically, NN_ILEACH extends the network lifetime to an impressive 11,361 rounds, compared to only 505 rounds achieved by LEACH under identical conditions—representing a more than 20-fold improvement. Additionally, NN_ILEACH achieves a 30% increase in throughput and a 25% enhancement in packet delivery ratio, while reducing overall energy consumption by 40%. These results underscore the protocol’s potential to optimize energy usage and maintain network stability, paving the way for more resilient IoT systems in dynamic environments. Future work will explore further integration of machine learning techniques to enhance adaptability and performance in WSNs.