@Kailash *******
if you didn't BUY a tourist visa from a thai consulate before you came here but were stamped in for 30 days for free you're on what's known as a visa exempt entry.
Be that as it may, you can apply for a 30 day extension on it for 1900baht. They ADD the extension to your expiration date so you don't lose any time going early.
Once you apply for the 30 day extension, you can immediately apply for the 90 day Non-O visa right after that. .