The deployment of new 5G services and future demands for 6G make it necessary to increase the performance of access networks. This challenge has prompted the development of new standardization proposals for Passive Optical access Networks (PONs) that offer greater bandwidth, greater reach and a higher rate of aggregation of users per fiber, being Time- and Wavelength-Division Multiplexing (TWDM) a promising technological solution for increasing the capacity by up to 40 Gbps by using several wavelengths. This solution introduces tunable transceivers into the Optical Network Units (ONUs) for switching from one wavelength to the other, thus addressing the ever-increasing bandwidth demands in residential broadband and mobile fronthaul networks based on Fiber to the Home (FTTH) technology. This adds complexity and sources of inefficiency, such as the laser tuning time (LTT) delay, which is often ignored when evaluating the performance of Dynamic Bandwidth Allocation (DBA) mechanisms. We present a novel DBA algorithm that dynamically handles the allocation of bandwidth and switches the ONUs’ lasers from one wavelength to the other while taking LTT into consideration. To optimize the packet delay, we introduce a scheduling mechanism that follows the Longest Processing Time first (LPT) scheduling discipline, which is implemented over the Interleaved Polling with Adaptive Cycle Time (IPACT) DBA. We also provide quality of service (QoS) differentiation by introducing the Max-Min Weighted Fair Share Queuing principle (WFQ) into the algorithm. The performance of our algorithm is evaluated through simulations against the original IPACT algorithm, which we have extended to support multi-wavelengths. With the introduction of LPT, we obtain an improved performance of up to 73% reduction in queue delay over IPACT while achieving QoS differentiation with WFQ.