Sleep is often an allegory for death. As far as we know, The Epic of Gilgamesh didn't originate this idea, but you can find it in literature and religion the world over.
Having said that, we can almost hear that ol' Utanapishtim snickering when he suggests that Gilgamesh demonstrate his worthiness of immortality by not sleeping for seven days! It is kind of like saying, "well, if you want to be immortal, you can just go ahead and prove you deserve immortality. By not dying."