This paper deals with Distributed Generation (DG) system requiring power quality features such as current harmonics, reactive power compensation, and power factor improvement in grid tied operation. The motivation is to combine DG system with the capabilities of shunt active filter to perform real power injection, current harmonics mitigation and power factor improvement. The control algorithm employed in this setup utilizes a reference current generator based on p-q theory together with a pulse width modulation controller for switching pulse generation. The control strategy utilizes PI controller with Genetic Algorithm (GA) and Particle Swarm Optimization (PSO) for finding optimal PI controller parameters. The effectiveness of the proposed method is verified using MATLAB/Simulink and experimental model developed for 3kWp inverter. The PI-PSO controller injects 0.588kW active power into the grid results in sharing 54% of load power demand and the current harmonics is reduced from 23.70% to 1.63%. The obtained results demonstrate that the grid tied inverter maintains harmonic standards in accordance with the IEEE-519 standard while injecting maximum possible active power to the line.