Billy Joel gets a lot of song ideas in his dreams, and often struggles to remember them when he wakes up. For this song, however, he woke up with the song in his head, but tried NOT to write it. He explained on The Howard Stern Show in 2010: "I thought, Who the hell am I to try to pull off this gospel song, so I took a shower to wash this song away. I sang it in the shower and knew I had to do it."
In Joel's dream, he was "walking in his sleep," which inspired that lyric. http://www.songfacts.com/detail.php?id=4600