If this is an abnormal behavior coming out of your hamster then there must be something wrong with it. Find out what is the problem in home that is making him sleep outside.
It can be due to cold in the house so provide it with a better and warm place. This can just be behavioral problem but you need to find out what this problem is.