The efficacy of Wireless Sensor Networks (WSNs), a subset of Wireless Ad-hoc Networks, is significantly impacted by application, lifetime, storage capacity, processing power, topology changes, communication medium, and bandwidth. These constraints necessitate a robust data transport control in WSNs that considers service quality, energy efficiency, and congestion management. Congestion is a significant issue for wireless networks. Congestion in WSNs has deleterious effects on loss rate, channel quality, link utilization, number of retransmissions, traffic flow, network lifetime, latency, energy, and throughput. The predominance of WSNs necessitates the development of more efficient congestion control algorithms. Since it has been demonstrated that the routing problem is NP-hard and that heuristic-based methods outperform their traditional counterparts, routing is one of the most prevalent techniques for reducing the energy consumption of nodes and increasing throughput in WSNs. This study presents Rate Aware Congestion Control (RACC), an efficient method for avoiding congestion that improves network performance by employing Modified Harris Hawks Optimisation (MHHO). Initially, nodes are clustered utilizing the DBSCAN clustering algorithm. The simulation results of the developed technique indicate superior service, low latency, high energy, a high packet delivery ratio and an increasing number of living nodes when compared to existing approaches.