Not sure if this solution was posted before or not but this is what worked for me:
I use a Linksys WRT54G Router (old school one)
I have the lastest iOS 6.1.2 on iPhone 4S and iPad 3
I was not able to maintain a constant connection on my wifi network. When phone went to idle/sleep, I would have to connect once again to the wifi network, put my password again etc etc.
I narrowed it down to the fact it was a "wireless security" issue. Not the phone nor the router being an old one. I was using the WPA2-Personal (TKIP+AES). i changed it to WPA2-Personal (AES) and it worked without a hitch. I have been monitoring this for 2-3 days now and everytime I restart my iPhone 4S or even put it to sleep, it connectes to the wifi network just as it should - automatically.
I hope this might help someone
