The Markit/CIPS construction purchasing managers' index rose to 56 from 53.1, its highest level since December 2015. A figure above 50 indicates expansion.
Builders also hired more workers and ordered more supplies to deal with an increase in new projects.
Economists said the sector was recovering after a slow start to 2017.
"A sustained rebound in residential building provides an encouraging sign that the recent a soft patch for property values has not deterred new housing supply," said Tim Moore, senior economist at IHS Markit.
"Instead, strong labour market conditions, resilient demand and ultra-low mortgage rates appear to have helped boost work on residential development projects."
The data contrasts with reports earlier this week suggesting greater caution by homebuyers and lenders.
Building society Nationwide said house prices had fallen for a third consecutive in May - the longest run of decline since 2009, just after the financial crisis.
Meanwhile, the Bank of England said loan approvals fell to a seven-month low in April.
The latest Markit/CIPS construction reading was still much weaker than the post-crisis high of 64.6 seen in January 2014.
However, the survey found there had been solid rises across the whole sector in May, including in civil engineering and commercial building.
Input prices for construction firms also rose at the slowest pace for seven months, despite the prolonged weakness of the pound.
Samuel Tombs, chief UK economist at Pantheon Macroeconomics, said the result suggested the Brexit vote's "dampening influence on construction activity is fading".
But he added: "Note, however, that the PMI has had to exceed 53 in the past to signal growth.
"May's PMI reading, therefore, is consistent with quarter-on-quarter growth in construction output of only about 0.5%."
Activity in the UK construction sector expanded at its fastest rate in 17 months in May, boosted by a surprise rebound in homebuilding, a survey says.