Apply for a non O visa in your home country using the link Brandon supplied.
When you arrive in Thailand 🇹🇠with your Non O visa, open a Thai bank account.
If you want to extend after 90 days, you will need to show that you have had 800,000B in your Thai bank account for two months prior to extending. And for 3 months after as well.
Following that, the amount cannot drop below 400,000B until the cycle starts again.
For the extension requirements, please visit your local immigration office to get a list of their requirements. They may vary from office to office.
Some offices MAY be ok with you having the 800 000B sitting in a fixed term account but most do not.
In short, apply for your Non O visa in your home country, no longer than 3 months before you go, get stamped in and go to your local Immigration Office to find out what their requirements are for an extension.
The 800,000B is a non negotiable for your first extension. Unless of course you are from one of the minority of countries where your embassy can verify that you get a pension or equivalent transferred in that amounts to 65,000 per month.