Ryan Baylock was happily settled in Fort Greene, Brooklyn, where he shared a three-bedroom apartment with roommates. It had a washer-dryer, a parking spot and a backyard.

“It was a great situation,” he said. “I couldn’t really ask for anything else.”

Time marched on. New roommates, almost always acquaintances, moved in and out. His share of the rent rose to $975 a month. Then last winter, when a roommate vacated, no friends of friends surfaced.

“Having to fill the spot was an added stress,” Mr. Baylock said. “I didn’t want this being part of my life, having to go through this process every year or two.”