There is a lot of good info in both the Bangkok Airport and TG forums, where you will find all of your questions asked and answered.
There are hotels nearby, and airside day rooms, but you will not be able to get airside until you check-in with UA, pay your departure tax and clear immigration.
The UA counter probably opens at 05:00.