An energy gap between the valence and the conduction band is the defining property of a semiconductor, and the gap size plays a crucial role in the design of semiconductor devices. We show that the presence of a two-dimensional electron gas near to the surface of a semiconductor can significantly alter the size of its band gap through many-body effects caused by its high electron density, resulting in a surface band gap that is much smaller than that in the bulk. Apart from reconciling a number of disparate previous experimental findings, the results suggest an entirely new route to spatially inhomogeneous band-gap engineering.