The document presents a new control strategy for controlling a shunt active power filter to compensate for reactive power and reduce current harmonics in a grid connected to a renewable energy based distribution system. The proposed control strategy uses a fuzzy PID controller to determine the reference compensating currents for a three-phase shunt active power filter. Simulations in MATLAB/Simulink show that the controller has fast dynamic response, accurately tracks the DC voltage reference, and is robust to load parameter variations. The fuzzy PID controller hybridizes classical PID and fuzzy control to exploit the benefits of both.