The corrosion behavior of PEO coatings of four MgAl alloys was investigated with the emphasis on the effect of Al contents in the substrates. Results indicate that the volume fraction of β phase (Mg17Al12) and interfaces of β/eutectic phase (α+β) increased with the increasing Al content, which have strong influences on the microstructure, i.e., the components and the porosity level of PEO coatings. PEO coatings were composed of two layers: an inner layer (IL) and an outer layer (OL). The differences in components of the IL can be ascribed to the enrichment of Al in β phase and eutectic phase (α+β) compared to α phase, which facilitate to form MgAl2O4. The increased defects of the IL caused by the increasing interfaces could be related to the high misfit degree and difference of Fermi energy (Ef) of components of IL. The porosity level of the PEO coatings first decreases and then increases with the increasing Al content caused by different discharging behaviors. It is found that the corrosion resistance first increases and later decreases, and resulted from microstructures of PEO coatings on different MgAl alloys.