The addition of Cr nanoparticles to a plasma electrolytic oxidation (PEO) electrolyte offers the possibility of producing layers with a broader range of coating compositions and improved properties. In this study, the effects of nanoparticles and various voltages on coating formation, microscopic morphology, and phase composition were investigated with in situ incorporation of Cr nanoparticles into PEO-coated Mg alloy. The results show that the corrosion performance of the coating was significantly improved when the final voltage was set to 460 V and the concentration of Cr nanoparticles was 1 g/L. Compared to the particle-free coating, the corrosion current density of the coating with the addition of 1 g/L Cr nanoparticles was reduced by two orders of magnitude. The impedance at the low frequency (0.01 Hz) increased by more than one order of magnitude after one hour of immersion, indicating a considerable improvement in corrosion resistance. Due to the high temperature during the coating-formation process, the Cr nanoparticles were oxidized, resulting in the formation of Cr2O3. The existence of Cr2O3 slightly increased the growth rate of the coating and sealed the open pores of the coating.