Clustering of sensor nodes is a prominent method applied to wireless sensor networks (WSNs). In a cluster-based WSN scenario, the sensor nodes are assembled to generate clusters. The sensor nodes also have limited battery power. Therefore, energy efficiency in WSNs is crucial. The load on the sensor node and its distance from the base station (BS) are the significant factors of energy consumption. Therefore, load balancing according to the transmission distance is necessary for WSNs. In this paper, we propose a hybrid routing algorithm based on Naïve Bayes and improved particle swarm optimization algorithms (HRA-NP). The cluster heads (CHs) are selected according to the CH conditional probability, which is estimated by the Naïve Bayes classifier. After the selection of the CHs, the multi-hop routing algorithm is applied to the CHs. The best routing path from each CH to the BS is obtained from an improved particle swarm optimization (PSO) algorithm. Simulations were conducted on evaluation factors such as energy consumption, active sensor nodes per round, the sustainability of the network, and the standard deviation of a load on the sensor node. It was observed that HRA-NP outperforms comparable algorithms, namely DUCF, ECRRS, and FC-RBAT, based on the evaluation factors.