Electronic configuration:
There are four valence electrons to fit within the three hybridized sp2 orbitals and the remaining 2p orbital, for carbon. The first three electrons are fitted within each of the hybridized orbitals as per to Hund's rule such that they are all half filled. This left over one electron yet to place. There is a choice among pairing it up in a half-filled sp2 orbital or placing it into the vacant 2py orbital. The general principle is to fill up orbitals of equivalent energy before moving to an orbital of higher energy. Though, if the energy variations among orbitals are small (as here) it is easier for the electron to fit into the higher energy 2py orbital resultant in three half-filled sp2 orbitals and one half-filled p orbital. Four bonds are feasible.