General Background Wireless Sensor Networks (WSNs) remain a foundational technology for Internet of Things (IoT) deployments, offering capabilities for distributed sensing, localized data collection, and multihop communication toward edge gateways or sinks. Specific Background Routing layers within WSN designs dictate packet delivery ratios, end-to-end delays, energy consumption, network congestion, and overall operational lifetimes. Knowledge Gap Traditional routing models often rely on minimum hop counts or simplistic shortest-path metrics, which can cause early battery depletion on near-sink relay nodes and ignore dynamic wireless link variability. Aims This study introduces a computer-engineering framework designed to optimize routing protocols for WSN-based IoT systems through a novel Energy and Link-Quality Aware Routing (ELQAR) model. Results Simulation experiments demonstrate that the ELQAR framework achieves higher packet delivery ratio stability under dense node distributions, mitigates delay growth during heavy traffic loads, and extends network lifetime markers compared to baseline protocols. Novelty The approach combines remaining energy, expected transmission quality, forward hop progress, queue load, and route freshness into a unified next-hop selection score without requiring global topological information. Implications This framework provides a reproducible design and simulation environment that can be integrated into resource-constrained embedded nodes and gateway architectures to balance reliability, energy efficiency, and latency. Key Findings Highlights The ELQAR routing model combines residual energy, link quality, forward progress, queue state, and stability into a single normalized score to select optimal next-hop parents. Simulation results indicate that the optimized routing approach maintains superior packet delivery ratio stability as node densities increase from 25 to 150 nodes. Network lifetime checkpoints show that the proposed framework extends operational rounds before initial node failure and total network depletion compared to shortest-hop, LEACH-style, and RPL-like routing approaches. Keywords Wireless Sensor Networks, Internet Of Things, Routing Optimization, RPL, Energy-Aware Routing