Yes, you can go out of airport to sleep. However not recommended. Once you get out of immigration/customs you are not longer considered transit passenge and hence you may have to check out the bags. Transit system is DELHI is a pain!!!
I just came back via Delhi as a transit passenger, and did not go out. Here is the process if you are transit and NOT going out.
1. As you get out of your plane, look for airiline representative of the flight you arrived in. For example, if you arrived in Delhi on a Sahara flight, look for Sahara representatives. They will be outside the door or right before the customs/immigrations area.
2. They will take your information and escort you to the transit area. REMEMBER, only they can take you to the transit area. You cannot just walk in!!!!!
3. Now is the painful part... You have to wait for airline representatives of your outbound flight. They will come (eventually, never know when) you better not be in the restroom or stores or checking email or they will not find you! they have to get you the boarding pass. i got mine 30 minutes before flight time!
Good luck if you go via Delh (make sure you have plenty of transit time), else try to avoid it.
Hope this helps