The study develops an optimized SHE procedure to regulate a CHB-MLI powered by PV modules which use unequal DC sources. The main goal involves finding suitable switching angles that produce minimal low-order harmonics during steady output voltage operation under variable input scenarios. The Red-Tailed Hawk Algorithm (RTHA) serves as a recent bio-inspired metaheuristic optimization method to solve effectively the nonlinear transcendental SHE equations. The MATLAB/Simulink environment implements a validation of the proposed method by modeling a three-phase 7-level CHB-MLI system. A performance evaluation of the proposed algorithm occurs against established optimization methods consisting of Particle Swarm Optimization (PSO) and Grey Wolf Optimization (GWO) and Whale Optimization Algorithm (WOA). Total Harmonic Distortion reduction, computational efficiency and convergence rate serve as the three main performance indicators for evaluation. The experimental findings show RTHA accomplishes higher harmonic reduction while offering improved speed and stability when dealing with unequal DC voltage issues when contrasted against traditional optimization methods. RTHA operates better than analytical approaches in real-world inverter applications through its flexible and adaptable approach despite needing complex calculations and preset conditions. The scale-up of RTHA applications requires additional research because excessive computational requirements and initial value dependencies must be addressed. The research shows that RTHA-based SHE optimization represents a viable and implementable solution for power quality advancement in renewable energy systems.