So I was searching about this problem today and here is a forum deidcated to it. Hopefully 2 days till iOS7 and we will be OK.
I got my son an iPhone 4S a couple of weeks ago and noticed his seems to have connection issues, yup, his wifi is dropping out when the screen is locked.
Now, I have a 4S also, from 2012 and I DO NOT have this problem. Perhaps I have more things that are keeping my connection alive?
It frustrates me because the 4S also has the problem where when you leave wifi the 3G disconnects, which then you have to go to Airplane mode and toggle off/on to restore (not all the time, but enough).
Two phones, one has the issue and one does not.
Tried many of the tricks here without much resolve.
----
UPDATE:
I take that back....I see now if it is unplugged the connection goes to sleep..what I do not understand then is why my sons phone seems to be slow with iMessage and stuff when he is home unless he is just bouncing between Wifi and 3G. This would theoretically mean he could not get Facetime when his phone is locked, that stinks.