The emerging needs of innovative services in different areas led to the development of advanced intelligent systems using the heterogeneous technologies, devised by Internet of Things (IoT). IoT focuses on integrating the networks to facilitate smooth services to the humans. The interface between mobility patterns and the routing protocols contributes significantly to alter the performance of network. This paper proposes routing protocol based on Sunflower based grey wolf optimization (SFG) algorithm for improving the network lifetime. The first step is the simulation of IoT and then, the multipath routing is initiated in the IoT network. The SFG algorithm selects the best path from the multipath available for routing, based on Context awareness, Network lifetime, Residual Energy, Trust, and Delay. Finally, the multipath routing takes place in the IoT network through optimal routing path selected using the proposed SFG algorithm. The proposed SFG algorithm is designed by integrating sun flower optimization (SFO) and the grey wolf optimizer (GWO) such that the optimal routes are selected. The proposed SFG outperformed other methods with minimal delay of 0.779 s, maximal energy of 0.203 J, maximal network lifetime of 98.039%, and maximal throughput of 47.368%, respectively.