The whole sleep thing, like everyone else said, was magic. Magic really doesn't need an explanation.
Now as far as eating goes and sleeping goes, if you look back in a lot of other video games, you'll see that people don't eat or rest either. Of course there are those that do let you do so. And there are Zelda games where Link sleeps and eats. Disregarding that, I have actually theorized that whenever Link gets magically healed by things like fairies and potions, these are actually nourishing him and allowing him to "sleep without sleeping." Whenever Link gets tired or sick, his hearts go down. But whenever he eats something good or rests, his hearts go up. Correlating that, is pretty easy to say that all the needs of his body, not just his physical wounds, are taken care of whenever he gets healed.