You apply for a new passport thru the ACS (American Citizens Services) website (some can do the renewal by mail, but some have to go in person)
Once you get the new passport, you take it, the old one, the letter that comes with the new one from the US embassy and go to your immigration office where you got the extension and get the stamps transferred to the new passport. They will move the currently valid extension (and any re-entry permits) to the new passport and then you just use it when you travel
This tells you how to renew an adult passport from the US in thailand
*****************************************************************************