Energy management plays a crucial role in achieving extended endurance for solar-powered Unmanned Aerial Vehicles (UAVs). Current studies in energy management primarily focus on natural energy harvesting and task-oriented path planning. This paper aims to optimize energy consumption during the climb and glide stages by exploring variable climb speeds and glide powers. To achieve this, fitness functions are established for both the climb and glide stages, taking into account the maximum climb speed and glide power limits of the aircraft. The particle swarm optimization (PSO) algorithm is employed to solve the problem, resulting in significant energy savings of over 68% in the climb stage and 4.8% in the glide stage. Based on an analysis of the optimization trends, this study proposes an energy-management strategy to fulfill the demand for long-endurance flights. The findings of this study can serve as a valuable reference for high-altitude missions that require extended flight times.