If it's a connecting flight there is passport control at the transfer gate to BKK domestic from international where you'll most likely get your passport checked.
Be careful with any short trips to China. I did China for holiday (Xi'an and Shanghai) last year around November, and cut my trip short to only 5 nights.
Going through Pudong airport passport control they took my passport for 40mins while I sat in no mans land between passport control and security baggage checks before going to the gates, wondering what was going on. Until she came back with my passport and 4-5 other officers all standing around me interrogating me asking what I was doing in China, Thailand, Malaysia and so on, if I was working in China and these countries.
I had to pull out my phone and show them touristy photos I took all over the place before they let me go with the biggest angry greasy look on their faces.
You can extend your visa by 30 days at any immigration office in Thailand, there's no need to leave the country, after the 30 days though you will need to leave the country be it to do a visa run or whatever yours plans are.
The cost is 1900 baht to extend and the necessary form needs to be completed, photo copies of your visa page and main info page signed, a photo, and you pick up same day.
Skyscanner. Then put "everywhere" int he destination, and pick your dates. This will give you the cheapest flights return to Bangkok, categorised by country.
Depending what passport you have you can get a 30 day visa exempt stamp on entry by air and then extend it by 30 days at your local immigration office with 1900 baht, filling out the correct forms, and providing the right documentation.