This paper presents a new routing method for wireless sensor networks (WSNs) that improves energy efficiency by using learning automata to select data transmission routes based on energy levels and distance to the sink. The proposed algorithm addresses energy waste caused by static routing paths, instead dynamically choosing optimal routes to extend network lifetime. Simulation results indicate that this method significantly enhances remaining energy and overall network longevity.