According to the VSEPR model, a molecule takes a shape that minimizes the repulsion between bonding pair i.e. bond pair, and non-bonding pair i.e. lone pair of electrons.
Lone pair - bond pair repulsion > bond pair - bond pair repulsion
In the NH3 molecule, three bonding pairs of electrons and one lone pair of electrons are present. Due to the presence of lone pair of electrons the regular tetrahedral structure of NH3 is distorted to give a triangular pyramidical shape and has a bond angle of 106°45'. This gives the maximum stability between the bond pair and the lone pair of electrons.