As Mayor Bill de Blasio struggles to control rising homelessness in New York, the city plans to hire more lawyers to help financially stressed residents avoid eviction—especially in neighborhoods that are quickly gentrifying.

By mid-2017, the city will be spending $60 million annually—up from about $34 million now—on an expanded legal team to address the flow of homeless into an already overburdened shelter system and the number of people living on the streets. The city has found that about 32% of the families in its shelters...