Internet of Things (IoT) in recent times offers a greater amount of flexible design during the deployment of it in the form of network. The interfacing of IoT with a wireless sensor network (WSN) requires an optimal solution to preserve the consumption of energy while the data has been transmitted via nodes. In this paper, we develop machine learning (ML)-assisted routing to route the data packets of IoT sensors from the real-time environment over WSN. In this study, we use three different planes for optimal routing of packets from the source node to the destination node. The source node is the IoT sensors that involve data collection, and the intermediate nodes are the WSN sensor nodes that route the packets. Optimal routing decisions based on the pre-trained data in an artificial neural network (ANN) stabilize the routing of data packets without congestion. The simulation is conducted to test the efficacy of the ANN routing in the integrated network, and the results show that the ANN-based routing achieves higher energy efficiency and throughput than other models.