The Sine–Levy tuna swarm optimization (SLTSO) algorithm is a novel method based on the sine strategy and Levy flight guidance. It is presented as a solution to the shortcomings of the tuna swarm optimization (TSO) algorithm, which include its tendency to reach local optima and limited capacity to search worldwide. This algorithm updates locations using the Levy flight technique and greedy approach and generates initial solutions using an elite reverse learning process. Additionally, it offers an individual location optimization method called golden sine, which enhances the algorithm’s capacity to explore widely and steer clear of local optima. To plan UAV flight paths safely and effectively in complex obstacle environments, the SLTSO algorithm considers constraints such as geographic and airspace obstacles, along with performance metrics like flight environment, flight space, flight distance, angle, altitude, and threat levels. The effectiveness of the algorithm is verified by simulation and the creation of a path planning model. Experimental results show that the SLTSO algorithm displays faster convergence rates, better optimization precision, shorter and smoother paths, and concomitant reduction in energy usage. A drone can now map its route far more effectively thanks to these improvements. Consequently, the proposed SLTSO algorithm demonstrates both efficacy and superiority in UAV route planning applications.