(i) When a semiconductor is doped with a trivalent impurity (like boron), an acceptor level is created just above the valence band. This decreases the energy gap because the electrons in the valence band can now easily jump to the acceptor level, making the material more conductive.
(ii) When a semiconductor is doped with a pentavalent impurity (like phosphorus), a donor level is created just below the conduction band. This also decreases the energy gap, as electrons can easily be excited from the donor level into the conduction band, increasing conductivity.