There are several ways of earning money and passive income while you sleep.
You can try investing in stocks and bonds, start a savings account and earn interest on the money you deposit in the savings account.
You could also buy homes and then rent them out for a profit and let someone else manage the property and the income and then you pay the property manager a fee and they pass the rental income onto you.
Affiliate marketing or even blogging is another option to earn money while you sleep.
For blogging though and affiliate marketing you need to work hard in the beginning for at least 5 to 6 years and write lots of quality content for the blog and then as you get search engine traffic over the years you can be earning money in your sleep.
I started 8 years ago and worked hard blogging for 6 years without making much money but now it's making a nice income while I sleep without me having to do much work to keep it going and as long as I blog a few times per month the income and search traffic keeps coming in.
I earn money promoting services and products through affiliate programs as well as using Taboola and Adsense.
While I sleep the blog is making me money and I now earn more income from my blog than I ever did or will at the job I used to work for.