The unified power-quality conditioner (UPQC) is used to mitigate the current and voltage-related power-quality (PQ) problems simultaneously in power distribution systems. Among all of the PQ problems, voltage sag is a crucial problem in distribution systems. In this paper, a new methodology is proposed to mitigate the unbalanced voltage sag with phase jumps by UPQC with minimum real power injection. To obtain the minimum real power injection by UPQC, an objective function is derived along with practical constraints, such as the injected voltage limit on the series active filter, phase jump mitigation, and angle of voltage injection. Particle swarm optimization (PSO) has been used to find the solution of the objective function derived for minimizing real power injection of UPQC along with the constraints. Adaptive neuro-fuzzy inference systems have been used to make the proposed methodology online for minimum real power injection with UPQC by using the PSO-based data for different voltage sag conditions. The proposed method has been validated through detailed simulation and experimental studies. © 2011 IEEE.