What do you do when a candidate for mayor of New York City is sleeping on your couch?

Katherine Wilson, a nurse’s aide who is unemployed, tiptoed around Bill de Blasio, the New York City public advocate, as he lay in her living room in a Harlem housing project on Sunday morning, his 6-foot-5 frame slightly exceeding the length of the couch. She walked into the kitchen, thinking she might quietly whip up a plate of eggs and bacon for him. But the slam of a bathroom door, she said, seemed to startle him awake.

“It was a dream,” Ms. Wilson said. “I’ve never had anyone like that in my house before.”

The mayoral race took on the air of a reality show this weekend as five Democratic candidates, who came with sleeping bags and travel-size tubes of toothpaste, spent a night with residents of Lincoln Houses, a 3,100-resident complex constructed in 1948.

It was a stark change of scenery for the candidates, some of whom reside in million-dollar homes.

On Saturday night, they slept on floors or sofas, braved rooms without air-conditioning, and endured showers with weak water pressure. They stayed up past midnight watching television shows like “CSI: Miami” and bonded with residents about the Yankees and the heat wave.

The candidates emerged at a news conference at dawn, bleary-eyed and cradling cups of coffee. Most of them wore their best casual wear, with Anthony D. Weiner, the former congressman, in red shorts, and John C. Liu, the city comptroller, in a white T-shirt. Mr. de Blasio wore a suit, ready for an appearance at church. Looking out on a crowd of cameras, the candidates said they had gained a better understanding of the plight of low-income families.