This paper explores how housing modifies the temperature-mortality relationship in the Eastern and Western Cape provinces of South Africa. We estimate dose-response relationships for residents living in each of the five common types of South African housing by combining linear-threshold models for Cape Town with concurrent data on the city's housing composition and expert estimates of how well different types of housing protect against heat and cold. We then apply temperature data to determine provincial-level dose-response relationships, relative risks, attributable fractions and mortality burdens for heat and cold under seven housing scenarios--three past, three future and a scenario of maximum protection. We find that future mortality burdens would be lower under a policy scenario that prioritizes the replacement of informal housing compared to one that prioritizes the replacement of traditional dwellings. In a maximum protection scenario, where everyone lived in houses characteristic of the wealthy, temperature-related mortality could be reduced by over 50% (approximately 5000 deaths annually) in the two provinces combined. These results have relevance to current housing policy but also reinforce the importance of the built environment in mitigating adverse effects of future climate change.