The Internet of Things (IoT) integrates different advanced technologies in which a wireless sensor network (WSN) with many smart micro-sensor nodes is an important portion of building various IoT applications such as smart agriculture systems, smart healthcare systems, smart home or monitoring environments, etc. However, the limited energy resources of sensors and the harsh properties of the WSN deployment environment make routing a challenging task. To defeat this routing quandary, an energy-efficient routing protocol based on grid cells (EEGT) is proposed in this study to improve the lifespan of WSN-based IoT applications. In EEGT, the whole network region is separated into virtual grid cells (clusters) at which the number of sensor nodes is balanced among cells. Then, a cluster head node (CHN) is chosen according to the residual energy and the distance between the sink and nodes in each cell. Moreover, to determine the paths for data delivery inside the cell with small energy utilization, the Kruskal algorithm is applied to connect nodes in each cell and their CHN into a minimum spanning tree (MST). Further, the ant colony algorithm is also used to find the paths of transmitting data packets from CHNs to the sink (outside cell) to reduce energy utilization. The simulation results show that the performance of EEGT is better than the three existing protocols, which are LEACH-C (low energy adaptive clustering hierarchy), PEGASIS (power-efficient gathering in sensor information systems), and PEGCP (maximizing WSN life using power-efficient grid-chain routing protocol) in terms of improved energy efficiency and extended the lifespan of the network.