The strength of attraction between the valence electrons and the nucleus of an atom increases as you move from left to right across a period.
This happens because, as you move from left to right across a period, the atomic number increases and the electrons are being added to the same energy level, i.e at the same distance from the nucleus.
This is referred to as effective nuclear charge - the number of protons increases, which means that the electrons feel more pull from the nucleus.
This is what causes the decrease in atomic size to take place.
This can explain in part explain the increase in melting point from sodium to aluminium. Sodium, magnesium, and aluminium all have metallic bonding, which implies cations attracted by delocalized electrons that form the famous sea of electrons model.
For metals, melting point is all about the strength of the attraction between the cation and the sea of electrons. The bigger the positive charge on the cation, the more electrons present in the sea of electrons, the greater the attraction between cation and electrons.
Sodiu, for example, loses 1 electron to form the
Here's where the increasing atomic number comes into play. More delocalized electrons means that the sea is more negatively charged; more protons in the nucleus means that the cations are more positively charged and smaller
Likewise, aluminium can lose three electrons to form the
So, as a conclusion, the increase in melting point is explained by the increase in the charge and decrease in the size of the cation and by an increase in the number of electrons present in the sea of electrons.