Proper control of distributed generator (DG) interfacing inverter can enhance the power quality and stability of microgrid (MG). For this purpose, a fractional proportional-resonant controller (FPR) is introduced in this article. Using fractional-order computation reduces the voltage and current harmonics of the controller which enables better performance of the system under non-linear load conditions. The proposed controller is used for both voltage control and current control inner loops. The main contribution of this article is controlling the voltage source converters using the voltage control method with proposed FPR controller. The proposed FPR controller improves the power quality parameters of DG in MG more than other conventional controllers. Also, tuning the coefficients of the proposed controller is optimized by the particle swarm optimization (PSO) algorithm which leads to presenting the new PSO-FPR controller. The new controller formulation is implied in a simulated 650V, 2.2kW islanding microgrid with a non-linear load in Matlab-Simulink software. Finally, the results show that the amount of total harmonic distortion (THD) of the inverter output voltage reduces.