In the Internet of Things (IoT) era, the demand for efficient and responsive computing systems has surged. Edge computing, which processes data closer to the source, has emerged as a promising solution to address the challenges of latency and bandwidth limitations. However, the dynamic nature of edge environments necessitates intelligent load-balancing strategies to optimize resource utilization and minimize service latency. This paper proposes a novel load-balancing approach that leverages learning automata (LA) to distribute real-time tasks between edge and cloud servers dynamically. By continuously learning from past experiences, the algorithm adapts to changing workloads and network conditions, ensuring optimal task allocation. The proposed algorithm employs a Service Time Measurement (STM) metric to evaluate servers' performance and make informed decisions about task distribution. The algorithm effectively balances the workload between edge and cloud servers by considering factors such as task complexity, server capacity, and network latency. Through extensive simulations, we demonstrate the superior performance of our proposed algorithm compared to existing techniques. Our approach significantly reduces average service time, minimizes task waiting time, optimizes network traffic, and increases the number of successful task executions on edge servers. Compared to previous approaches that partially addressed workload balancing, ALBLA offers a more comprehensive solution that optimizes resource utilization and minimizes energy consumption. Additionally, ALBLA's adaptive nature makes it well-suited for dynamic edge-cloud environments with fluctuating workloads. Our proposed approach contributes to developing more efficient, responsive, and scalable IoT systems by addressing the challenges inherent in edge computing environments.