Clustering is an effective technique in a wireless sensor network (WSN) to minimize energy consumption and low-energy adaptive clustering hierarchy (LEACH) is the most popular clustering protocol in WSNs. However, a random selection of cluster head (CH) in LEACH protocol results in poor performance in real network deployments. Dynamic formation of CHs and energy-aware clustering schemes helps in enhancing the lifetime of WSNs. In this paper, we have proposed an improved version of the grey wolf optimization (IGWO) algorithm to overcome the premature convergence of the basic GWO algorithm and it has been applied in optimizing the CH selection in WSNs to maximize the network lifetime. The improvements of IGWO algorithm are based on sink distance, CH balancing factor, residual energy, and average intra‐cluster distance. The proposed algorithm has been tested in terms of the number of rounds, number of operating nodes, number of transmissions, and energy levels used for communications. Using the proposed algorithm is compared with a conventional LEACH protocol and it is observed that the total number of operational rounds has been increased by 441.4% and 869.6% for a network size of 50 and 699.8% and 990.8% for a network size of 100 when CH selection probability is 5% and 10% respectively. The simulation results show that the proposed IGWO based LEACH protocol outperforms the existing state-of-the-art algorithms based on GWO for enhancing the WSNs lifetime.