The advent of Internet of Things (IoT) in agriculture has revolutionized the way farmers monitor and manage their crops. IoT-enabled sensors can provide real-time data on various environmental parameters such as temperature, humidity, soil moisture, and crop growth, which can be used to make informed decisions and optimize crop yield. However, the vast amount of data generated by these sensors poses a significant challenge in terms of data processing and communication. To address this challenge, clustering is often used to group the sensors into clusters and elect a Cluster Head (CH) to communicate with the gateway node. The selection of an appropriate CH and the optimal path for data transmission are critical factors that affect the performance of the IoT system. In this paper, we propose a novel approach to optimize the CH selection and path selection using modified Fuzzy Logic, Whale optimization algorithm (WOA) and Enhanced Crow Swarm Optimization (ECSO). Fuzzy Logic is used to evaluate the relevant parameters such as energy, distance, overhead, trust, and node degree to select the most suitable CH. ECSO is then employed to find the optimal path for data transmission based on the selected CH. We evaluate the proposed approach using simulation experiments in a smart agriculture scenario. The results show that our approach outperforms existing approaches in terms of throughput, packet delivery ratio, delay, and energy efficiency. Our proposed approach can significantly improve the performance of IoT-enabled smart agriculture systems, leading to better crop yield and higher profitability for farmers. The results of our simulation experiments demonstrate the superiority of our approach over existing one’s throughput, Packet Delivery Ratio (PDR), delay, energy consumption efficiency is found in the result section.