Because of the developments in this technology, wireless sensor networks are now among the most commonly used in the domains of agriculture, harsh environments, medical, and the military. Among the many problems with these networks is their limited lifespan. Much work has been done in the fields of sensor communication, routing, and data gathering to reduce energy usage and increase network life. Routing protocols and clustering algorithms are two techniques for reducing energy use. Selecting the cluster head is the most important stage in any clustering technique. The objectives of this article are to decrease total energy consumption, increase packet delivery rates, and lengthen the network's lifetime. In order to do this, the LEACH protocol uses cuckoo search instead of probability distribution during the cluster head selection step and fuzzy logic during the routing phase. A MATLAB environment was utilized to evaluate the proposed method with the LEACH algorithm under identical conditions. The results of the comparison show that the recommended approach does a better job of prolonging the network's lifetime than the LEACH protocol.