IF you stay inside the FIRST 90 days you got on entry OR from the Immigration Office using the Non Immigrant B visa, you can sit out the 90 days and just leave the country.
IF
you visited the Immigration Office and applied for and got issued a 1 year Extension of Stay permitted up to xx/xx/xx (it is a big stamp in your passport, just have a look) you visit the Immigration Office again to inform that the conditions of this stamp did change,.
You cancel this Extension of Stay with the last day of employment.
Let me try to explain as there is to much talk about incorrect visions:
Immigration gives you days to stay on entry starting on day of arrival.
Those who think it is arranged by hours or even minutes are wrong.
IF in this example, your stamp mention "Admitted until 15 Mar 2025" it simply means you have to leave Thailand BEFORE 23:59 hours on 15 Mar 2025.
So those who answer leave on the 15th are correct.
Now on airports the Immigration can use their flexibility, they might stamp your passport with overstay but NO fines if your overstay is less than 1 day.
Be aware ONLY on International Airports, NOT at border check points.
For those who try to explain otherwise and just claim I paid, please check your stamps.
Alternative is the Non Immigrant O visa to start with, get 90 days on entry, apply for the 1 year Extension of Stay with a Re-Entry Permit as that is specially designed for foreigners married to Thai citizens. At least you know that no questions will be asked at entry points about the multiple visa free entries each and every year.
You can apply year after year for a new 1 year Extension of Stay, as long as you can meet the requirements.
You will NOT get a work permit as a tourist on a free entry stamp.
Talk to HR as you have to apply for the Non Immigrant B visa before you can get the work permit.
Just for information, your are NOT allowed to work without both documents, visa and work permit. even when your employer tells you no problem we know a police officer in case you get arrested.