Another RPG sleeping mechanic that doesn't make much sense to me is only being able to use tents and sleeping bags on the world map. It's a fuggin' tent! Where you use it shouldn't matter (unless of course it's too cold, or you'd get in trouble with the law for sleeping there).
In dungeons or anywhere else legal excluding the world map, you could simply have the trade-off that someone in your party has to stay up as a lookout. (Realistically, this should probably apply on the world map too, but that sounds excessive) If you're alone in your party, you simply stand a greater chance of being attacked in your sleep since you don't have a lookout.
If this is implemented in action game or an MMO, the lookout could engage attacking enemies while the rest of the party sleeps. In this case, sleep could run on a timer (visualized as "rest bar") lasting no shorter than ten seconds, with longer durations resulting in a more restful sleep. Noise (from combat or otherwise) could affect the timer or even end sleep. Sleep would be forced to end if an enemy successfully attacks a tent. This essentially turns sleep into a game of tower-defense in highly-populated dungeons.
A possible character perk in a non-action game could include "sleeps with one eye open", when they're in your party you don't need a lookout. Another could be "doesn't require tent" where the character doesn't need a tent to sleep (they may require one to heal injuries, see HP-based Injury System).