Why do Nonmetals gain electrons?
Metals have very few electrons in their outer atomic shells and non-metals have more electrons in their valence shells and hence will tend to fill up the small gap in the valence shell. This makes the non-metals to gain electrons. In the case of metals, their atoms will have the outer most shells filled with very less number of electrons and hence metals tend to lose them to gain stability. Both metals and non-metals express the characteristic which is suitable for them.
There is a rule in the periodic table that the electro-negativity of non-metals is higher as this property increases from left side of the periodic table to its right. The non-metals and metals are separated from each other in the periodic table with the help of elements which have partially filled p Orbitals. The non-metals include halogens, noble gases, hydrogen, carbon, nitrogen, oxygen, phosphorus, sulfur and selenium. Non-metals usually have more ionization energy and electro-negativity. They gain electrons easily as they tend to become stable by accepting the electrons and fill up the outermost shell completely with electrons.
In the terms of electrostatic stability and filling up of molecular Orbitals, non-metals are nearer to those elements which have almost filled molecular Orbitals. The positive nuclear charge is more felt by the atoms of the elements lying on the right side of the periodic table. So, these elements belonging to the group called non-metals can effectively attract electrons as they possess higher positive charge. Though non-metals have the characteristic of gaining electrons, if they react with the elements present on the right side of the periodic table, they lose electrons. The resulting bond will be covalent instead of ionic. Reaction between a metal and non-metal will result in ionic bond while a weak non-metal forms a covalent bond with a strong non-metal.