Presently high housing prices are causing this; a lot more people would be living in SF today if there was more supply, which is equivalent to the high prices having kicked people out.
Do you have any policies in mind that could reduce the population without pricing people out? Maybe a Hukou system, or a right-to-reside lottery?