Background: Wireless sensor networks include a set of non-rechargeable sensor nodes that interact for particular purposes. Since the sensors are non-rechargeable, one of the most important challenges of the wireless sensor network is the optimal use of the energy of sensors. The selection of the appropriate cluster heads for clustering and hierarchical routing is effective in enhancing the performance and reducing the energy consumption of sensors. Aim: Clustering sensors in different groups is one way to reduce the energy consumption of sensor nodes. In the clustering process, selecting the appropriate sensor nodes for clustering plays an important role in clustering. The use of multistep routes to transmit the data collected by the cluster heads also has a key role in the cluster head energy consumption. Multistep routing uses less energy to send information. Methods: In this paper, after distributing the sensor nodes in the environment, we use a Teaching-Learning-Based Optimization (TLBO) algorithm to select the appropriate cluster heads from the existing sensor nodes. The teaching-learning philosophy has been inspired by a classroom and imitates the effect of a teacher on learner output. After collecting the data of each cluster to send the information to the sink, the cluster heads use the Tabu Search (TS) algorithm and determine the subsequent step for the transmission of information. Findings: The simulation results indicate that the protocol proposed in this research (TLSIA) has a higher last node dead than the LEACH algorithm by 75%, ASLPR algorithm by 25%, and COARP algorithm by 10%. Conclusion: Given the limited energy of the sensors and the non-rechargeability of the batteries, the use of swarm intelligence algorithms in WSNs can decrease the energy consumption of sensor nodes and, eventually, increase the WSN lifetime.