This paper presents a method for obtaining the desired reference current for Voltage Source Converter (VSC) of the Shunt Active Power Filter (SAPF) using Synchronous Reference Frame Theory. The method relies on the performance of the Proportional-Integral (PI) controller for obtaining the best control performance of the SAPF using Particle Swarm Optimization (PSO). SAPF compensates the harmonics by injecting a compensating current which is equal in magnitude but opposite in phase to the disturbance in the system. The current controller based on Triangular Carrier Current Controller is used to generate the gate pulses. Compensation current is generated to track command current so as to eliminate the harmonic current of non-linear load and reduced total harmonic distortion (THD), improved accuracy and strong robustness in the presence of parameters variation and nonlinear load. The results of simulation study of APF control technique presented in this paper are found quite satisfactory to eliminate harmonics and reactive power components from source current.