Whats the best iOS an iphone 3GS can upgrade to?

I was considering getting an iphone 3GS because they are very cheap (even though they are old) but i didn't know what the best iOS to upgrade it with would be without it playing up and getting slow. Please help. Also could i buy an iphone and then just get an iphone pay as you go sim?

They're going to stop making updates for the 3GS so a lot of apps you have, or will want wont be able to download on your phone. I would buy a phone upfront (full price so it's unlocked) and get it on a t-mobile prepaid account.t-mobile is reprogramming there network right now so if you get an iphone 5, you will get LTE data speeds soon:)

IOS 6

It will probably lag like a mofo. I have an old one on iOS 5 and it lags.

If you are interested in upgrading the OS then I would go iphone 4. 3GS is a good phone but a little outdated for hardware.

Hello if your money can stretch just a little more further then i would suggest getting at least a iphone 4 as this phone will be supported longer, the 3gs is pretty much at the end of its life.
My son uses my old iphone 3gs and he installed the new ios6 update and to be frank the phone is terrible now but it was pretty poor when he had it running ios5.
My wife on the other hand has the iphone 4 running ios6 and it runs quite well and smooth not as smooth as my iphone 5 which is understandable but it runs loads better then the older 3gs.

They are still being updated so they run the latest iOS version, 6.1.2.

As far as the other question, possibly.

It must be seen that giving this 4 year old phone the latest IOS is a gimmick
if it ain't got the hardware, it is just a redundant software

Phone technologies are advancing so quickly, only "orchard dwellers" are going back in time 2009 in this case to obtain an AFFORDABLE (PRE-OWNED) iPhone

For a lot less many are purchasing NEWER phones which at least have features

The IP3GS does not even have a camera flash!
http://www.gsmarena.com/apple_iphone_3gs-review-369.php

This decade as iphone are simply overpriced

Even the MID RANGE Samsung Galaxy Ace which cost much less is FAR SUPERIOR 5Mp camera 800Mhz Processor (3GS 600Mhz!) only the lack of a secondary camera (which is on Samsung Galaxy Ace II) on the ACE is the feature the IP4 has over the SG ACE.
http://www.gsmarena.com/compare.php3?idPhone1=2826&idPhone2=3724