Build a house with rooms that have doors, walls, chairs, tables, and light sources. More info here:
http://terraria.wikia.com/wiki/Home