In A Raisin in the Sun, why did all the scenes take place in the family house?
This is an excellent question and you have astutely recognised the important role that setting plays in this play. In many ways, the setting is meant to act as a powerful symbol of the Younger family and the pressures that they face. Note the way the initial stage descriptions describe their living room:
Its furnishings are typical and undistinguished and their primary feature now is that they have clearly had to accommodate the living of too many people for too many years--and they are tired... Weariness has, in fact, won in this room.
Such a description, as we come to see, perfectly describes the Younger family and the way that they are tired and exhausted from the many pressures that they face. Ruth is tired of all the work she has to do and the pressures of pregnancy, Walter is tired of not being able to provide for his family in the way that he wants to, Beneatha is tired of not being able to pursue her dreams, and Mama is tired of not having a home that can accommodate her family. The Younger family is in a state of crisis, and this is conveyed both through the tiredness of the living room itself but also through the rising sense of claustraphobia and pressure that is created through the setting. The characters literally have nowhere else to go, and can only explode and express themselves in this living room. The setting is definitely restricted, but this only serves to highlight the many restrictions facing a black family like the Youngers at the time of this play.
In A Raisin in the Sun, the Youngers's apartment stands for the confines of what the family has been allowed to do and the housing they have been able to manage to get, given racism and poverty. They are outgrowing the apartment, as Walter and Ruth's son, Travis, sleeps on the sofa, and Ruth is expecting another baby. Although they try to keep the apartment clean, it is dingy from long use. Mama long ago had the dream of making this apartment a comfortable place for her family, but it is now worn and too small.
Rather than representing safety and comfort, their apartment represents limitations and what Mama wants to escape by buying a larger house with a yard in a suburb that is mainly white. The scenes take place in the Youngers's house to emphasize the way their dreams have been unfulfilled to date. Just as the apartment is not pleasing to them, their lives have, at times, been unfulfilling as well.