You can earn money while sleeping and many do. But it's not easy to earn the money in the beginning.
In the beginning you will be working hard, and much harder than you work at your current job. There might be a few years that you'll work for pennies or even nothing.
Most people telling you that they earn a living online while sleeping have failed to mention that it took them a lot of hard work and sleepless nights and lots of patience to get to where they're earning money through there websites.
To make money with a website you need to pick a website niche that you know a lot about and are passionate about.
You also need a high paying niche for Adsense or other ad networks.
Once you get the website going then you'll need to post a blog post at least once per day.
You might be writing these blog posts for up to 6 years before you see any income or enough income per month to live off of.
If you don't get approved for adsense there are other ways to earn money online blogging.
You can sell affiliate products or services as well. Or even write your own E book.