Nowadays, Hybrid renewable energy systems (HRES) are increasingly being integrated into grid-connected load systems to lower losses and boost dependability. When the HRES system is connected to the grid system to satisfy needed load demand, power quality issues arise because of imbalanced load circumstances, non-linear load, and critical load. So this manuscript proposed a synergetic Unified Power Quality Conditioner (UPQC) application for power quality enhancement in microgrid distribution systems. The Sand Cat Swarm Optimization (SCSO) technique is based on the proposed sand cat swarm optimization method. The proposed strategy's primary goal is to regulate power flow, minimize harmonic distortion in both voltage and current waveforms, and maximize UPQC. By then, the proposed method's performance has been implemented into practice on the MATLAB platform and contrasted with several currently used techniques. The proposed technique displays the low Total Harmonic Distortion (THD) and operation time in all existing approaches like Moth Flame Optimization (MFO), Genetic Algorithm (GA), Salp Swarm Algorithm (SSA), Ant Lion Optimizer (ALO), Improved Bat Search Algorithm (IBSA), Lion Algorithm (LA), Artificial Bee Colony (ABC), Atom Search Optimization (ASO) and Crow Search Algorithm (CSA). The proposed method attains THD as before UPQC is 31%, after UPQC is 3%, load current is 1.42%, and load voltage is 2%. It also achieves a low operation time of 506ms and a low settling time of 0.15s compared to the existing methods. The significant improvement in power quality metrics demonstrates the effectiveness of the proposed SCSO technique.