The width of the depletion layer in a p-n junction diode decreases in forward bias due to repulsion of carriers from battery terminals, holes from p-type and electrons from n-type.
In an intrinsic semiconductor, n=p, hence energy levels of electrons and holes lies at the edges of conduction band and valence band. Therefore, the Fermi energy level is exactly in the middle of the forbidden gap.