I've stayed before in the transit hotel inside the airport, but I definitely don't recommend it. Something like $100 for 4 hours, which is way overpriced for what you get. But when time is very important, ie. trying to get as much sleep as possible on a very short connection, it can make sense. If you have a bit more time, there's any number of cheap transit hotels nearby the airport, as well as lots of options in town, which doesn't take very long to get to by taxi. There's the Novotel located right across from BKK, but again it's quite overpriced for my liking.
I've stayed often in the Louis Tavern lounges airside on short overnight transfers, being I have free access with my priority pass card. Without free access, I'd never consider it though. And there's no beds there, just some comfortable chairs you can put together to make a sort of bed, and you might get awoken after 2 hours, being that's supposedly the limit of the time you're allowed, though not often enforced late at night.
On my last trip I stayed at the Great Residence Hotel, which is about 6 minutes away from the airport, and they have a shuttle to pick you up and drop you off. Of course you'll need to wait a bit for the shuttle, so add that onto the time. In my case, I booked through Expedia and paid $23.53 total with tax, including the shuttle both ways. I waited about 5 minutes for the shuttle when I exited the airport, and booked the departure time in the morning and there was no waiting at all. There's varying rates depending on if you need the shuttle one way, both ways, or not at all. The rooms were very basic, but for just a transit hotel where I need only a shower and sleep, it did the job. Trying to contact their staff is a bit tricky, you need to exit gate 4 and find the person who's not allowed to hold up any sign, but once you find them, there's no problems. The shuttle's available 24 hours a day.
Now if you think you're going to get stuck with paying the airport departure fee of 700 THB per person, and if there's more than one in your party, then staying airside in the transit hotel might make a lot more sense. If it's not on one ticket though, then the tax should have already been collected on your departure ticket and there won't be any issue with paying additional for the departure tax due to exiting through passport control and re-entering.