The change in energy levels is minute and outweighed by the increase in nuclear charge (increase of two protons), the electrons added are all on the same principal energy level, so the effects of increased distance to nucleus and extra shielding is outweighed by the increased nuclear charge. so there is greater electrostatic attraction in between the nucleus and valence electron in Si than Mg.