A Wireless Sensor Network (WSN) is a group of autonomous sensors that are distributed geographically. However, sensor nodes in WSNs are battery-powered, and the energy drainage is a significant issue. The clustering approach holds an imperative part in boosting the lifespan of WSNs. This approach gathers the sensors into clusters and selects the cluster heads (CHs). CHs accumulate the information from the cluster members and transfer the data to the base station (BS). Yet, the most challenging task is to select the optimal CHs and thereby to enhance the network lifetime. This article introduces an optimal cluster head selection framework using hybrid opposition-based learning with the gray wolf optimization algorithm. The hybrid technique dynamically trades off between the exploitation and exploration search strategies in selecting the best CHs. In addition, the four different metrics such as energy consumption, minimal distance, node centrality and node degree are utilized. This proposed selection mechanism enhances the network efficiency by selecting the optimal CHs. In addition, the proposed algorithm is experimented on MATLAB (2018a) and validated by different performance metrics such as energy, alive nodes, BS position, and packet delivery ratio. The obtained results of the proposed algorithm exhibit better outcome in terms of more alive nodes per round, maximum number of packets delivery to the BS, improved residual energy and enhanced lifetime. At last, the proposed algorithm has achieved a better lifetime of ≈20%, ≈30% and ≈45% compared to grey wolf optimization (GWO), Artificial bee colony (ABC) and Low-energy adaptive clustering hierarchy (LEACH) techniques.