Thailand – Do I need a transit visa for a connection in Bangkok?

I want to book a flight to Yangon, Myanmar on Thai Airways. The stop times in Bangkok for the connection in both directions are from 10 to 15 hours.

If I want to leave the airport, do I need a visa for Thailand? If so, do I have to pay for both tickets, a week apart?