A Wireless Sensor Network (WSN) comprises numerous resource-constrained sensor nodes (SNs) that are tasked with sensing, processing, and transmitting data. Among the primary challenges in WSNs are optimizing energy consumption (EC) and extending network lifetime (NL). In this paper, a novel Energy-based Routing Algorithm for Adaptive Wireless Sensor Networks (ERA-WSN) is proposed to address these challenges. The ERA-WSN framework employs an Enhanced Temporal Convolutional Network (ETCN) for optimal cluster head (CH) selection, ensuring energy-efficient clustering. Subsequently, routing is performed using the Grey Wolf Optimization (GWO) algorithm to improve data transmission efficiency. The proposed method is evaluated using the NS2 simulator. Experimental findings show that ERA-WSN outperforms existing models such as FTOPOSIS-HJBO, EEACHS, and M-PSO methods in terms of latency, EC, packet delivery ratio (PDR), and NL. ERA-WSN decreases latency by 19.6% compared to FTOPOSIS-HJBO, 13.5% compared to EEACHS, and 16.1% compared to M-PSO methods respectively.