The song was leaked back in March 2008, many months before the release of I Am… Sasha Fierce, under the title "Beautiful Nightmare". With the release of the album, the title of the song was changed to its current title "Sweet Dreams".
The song is used in the commercial Knowles did for Crystal Geyser.
Turn the lights on
Every night I rush to my bed
With hopes that maybe I'll get a chance to see you when I close my eyes