Grouping the sensor nodes into clusters is an effective way to organize wireless sensor networks and to prolong the networks’ lifetime. This paper presents a static clustering algorithm that employs predator–prey optimization (PPO) for identifying cluster heads as well as routes for sending data to the sink. The objective of the optimization algorithm is to reduce the energy consumed in data collection and transmission, to achieve equalization in energy utilization by the wireless sensor nodes and to prolong the wireless sensor network lifetime while avoiding the expenses of cluster reformation in each communication round. The novelty of this algorithm is to treat the identification of cluster heads and the choice of transmission paths a unified optimization problem of minimizing the total energy cost of the network, whereas existing algorithms consider them two separate optimization sub-problems. PPO algorithm is applied to select the most appropriate pair of cluster heads for each cluster. It also identifies the optimum communication path, which can be single or multiple hop. The energy consumed in data transmission is reduced and a uniformity in residual energy of the nodes is achieved. The performance of the novel algorithm has been evaluated by observing the patterns in which nodes consume their energies. The number of packets that are successfully delivered has been found to be better than the existing static clustering algorithms, and at par with the finest dynamic clustering algorithms.