To seamlessly reconnect an islanded microgrid to the main grid, voltage phasors on both sides of the point of common coupling need to be synchronized before the main relay closes. In this paper, a distributed control strategy is proposed for microgrid synchronization operation. The proposed controller design utilizes pinning-based consensus algorithm to avoid system single point of failure. It is able to actively track the main grid frequency, provide a good coordination between frequency and phase regulation and ensure all distributed generations in the system proportionally share the load. Implementation of such distributed algorithm in practice is difficult because it requires mitigation of both distributed computing and power system engineering challenges. In this paper, a novel software platform called RIAPS platform is presented that helps implementing the proposed distributed synchronization strategy in practical hardware controllers. The performance of the controllers are validated using a real-time controller hardware-in-the-loop microgrid testbed.