This work presents the Whale migrating Algorithm (WMA), an innovative bio-inspired metaheuristic optimization method based on the collaborative migrating behavior of humpback whales. In contrast to conventional methods, WMA integrates leader-follower dynamics with adaptive migratory tactics to balance exploration and exploitation, improving its capacity to evade local optima and converge effectively. The performance of the proposed algorithm was meticulously assessed using the CEC-2005, CEC-2014, and CEC-2017 optimization problems and some restricted engineering problems, exhibiting enhanced accuracy, robustness, and convergence velocity relative to leading optimization techniques, such as PSO, WOA, and GWO. These findings confirm WMA is an effective instrument for addressing intricate optimization challenges across several domains.