In this work, we introduce the Multilevel Hierarchical Clustering (MLHC-m) algorithm, which is a new routing protocol that reduces the energy consumption in homogeneous and heterogeneous WSNs. MLHC-m employs clustering of WSNs more than one time every round. After the first clustering takes place, the heads of the clusters form a higher level of clustering with each other. This process is repeated form m times until reach the level m of clustering. The heads of the last level of clusters can communicate directly with the Base Station. Simulations show that MLHC reduces energy dissipation and prolongs the life time of the overall network compared with other existing protocols. Also MLHC increases the stability region (time from the starting of the network until the death of first node). © 2019 Author(s).