There's lots of data out there to suggest that there is a correlation between urban density and housing unaffordability. Take Hong Kong. It is very dense, and also one of the most expensive housing markets in the world. But I think the real question is: does urban density actually cause housing unaffordability, or do the two simply tend to be correlated when you plot a country's biggest cities?
One the one hand, there are factors that do drive up home prices when you build more densely. Building a reinforced-concrete high-rise is always going to be more expensive on a per square foot basis than building a wood-framed bungalow. But of course, the former also uses land a lot more efficiently, which is what you need to do in big and supply-constrained cities.
Michael Lewyn's view (credit to Robert Wright for sending me the article) is that density is incorrectly