A Normally, you can rent and enjoy your stay as long as the contract-duration stipulates. In rare occasions the landlord breaches the contract by selling the property.
Unfortunately there is not a lot you can do about this. Thai law and legislation is not really firm in protecting tenants’ interests. Long term lets or leases can be officially registered at Land Office Department (3 plus 3 years only).
Once registered at the Land Office Department your lease term is pretty safe and solid. This often applies with commercial leases.