The Internet of Things (IoT) creates an environment where things are permitted to act, hear, listen, and talk. IoT devices encompass a wide range of objects, from basic sensors to intelligent devices, capable of exchanging information with or without human intervention. However, the integration of wireless nodes in IoT systems brings about both advantages and challenges. While wireless connectivity enhances system functionality, it also introduces constraints on resources, including power consumption, memory, and CPU processing capacity. Among these limitations, energy consumption emerges as a critical challenge. To address these challenges, metaheuristic algorithms have been widely employed to optimize routing patterns in IoT networks. This paper proposes a novel clustering strategy based on the Gray Wolf Optimization (GWO) algorithm. The GWO-based clustering approach aims to achieve energy efficiency and improve overall network performance. Experimental results demonstrate significant improvements in key performance metrics. Specifically, the proposed strategy achieves up to a 14% reduction in energy consumption, a 34% decrease in end-to-end delay, and a 10% increase in packet delivery rate compared to existing approaches. The findings of this research contribute to the advancement of energy-efficient and high-performance IoT networks. The utilization of the GWO algorithm for clustering enhances the network's ability to conserve energy, reduce latency, and improve the delivery of data packets. These outcomes highlight the effectiveness and potential of the proposed approach in addressing resource limitations and optimizing performance in IoT environments.