If a foreigner wants to live in Thailand permanently, they should have lived for a total of 3 years in Thailand or should have married a Thai person for 5 years. This will help gain a Thailand permanent residency visa.