You don't need to go out, just extension at Immigration.
Theorically you can get your extension immediately, but some Immigration could ask you to come back just
****
days before stamp expires.
Extension costs 1,900 baht, you need to bring 1 photo, passport copies and fill the TM7 form