Abstract Wireless sensor networks (WSNs) technology is attracting the most of researchers and industry due to its application in wide contexts that include the military, surveillance, monitoring of habitat, health care, public safety and environmental monitoring. The consumption of energy is a crucial challenge faced in the WSN research. Clustering is an efficient technique for limiting the energy consumption of WSNs. But considering the hierarchical and cluster-based WSNs, the cluster heads utilize a high-level of energy because of data aggregation from various sensor nodes and transmit the same to the sink node. So, proper cluster head (CH) selection is required for sensor nodes’ energy conservation to prolong the network’s lifespan of the WSNs. In this paper, a CH selection protocol is proposed that is based on the quasi oppositional butterfly optimization algorithm (QOBOA). The proposed method is compared with original butterfly optimization along with certain existing algorithms with respect to the networks’ lifetime and efficiency of energy. Simulation results show that the QOBOA based CH selection scheme outperforms the existing ones.