Wireless Sensor Networks (WSNs) have an important role in establishing the communication between the Internet of things (IoT) devices. Routing is an important research field in the WSN as it helps in finding the suitable paths for the communication. This paper proposes a multipath routing algorithm based on the optimization approach. The proposed routing algorithm has two important phases, namely, Cluster head selection and multipath routing. Initially, the cluster head selection is carried out by the kernel based Fuzzy C Means (kernel FCM) algorithm. Then, the multipath routing is established by the newly developed Rider Salp Swarm Optimization algorithm (RSSA), which is the integration of the Rider Optimization Algorithm (ROA) and Salp Swarm Algorithm (SSA). The fitness function of the proposed RSSA is designed by considering the several factors, such as energy, QoS and trust. The simulation of the proposed work is carried out using different WSN setups, and the results are compared with several comparative techniques. From the results, it can be summarized that the proposed RSSA based multipath routing has better performance with values of 0.2526, 0.0764, 0.5, and 26 for delay, energy, throughput and number of alive nodes, respectively.