The non-linear and unbalanced load in a microgrid will increase the three-phase voltage unbalance factor and the total harmonic distortion(THD) which, in turn, will affect the microgrid power quality. A compensation algorithm for non-linear and unbalanced load based on the instantaneous power theory in dq reference frame is proposed. By measuring the instantaneous current of non-linear and unbalanced load and calculating or setting ideal instantaneous currents from other sources, the reference compensation current for voltage source inverter(VSI) is obtained. Inverse droop control is introduced to implement seamless conversion between different modes. In view of the microgrid with both the non-linear and unbalanced load and balanced and linear load, a load sharing method and a control strategy for the distributed generations(DGs) in the grid-connected mode and islanding mode are proposed. The results based on PSCAD/EMTDC simulation software have verified the correctness of the algorithm and the effectiveness of the control strategy in question.