My first move would to be to go to settings and completely reset your network settings...see if that flushes out the problem.
After that, if the problem still exists...i would reset my wifi router/modem and reconnect to the network. Also, while doing this, i would make sure that the router is up to date with firmware, sometimes communication issues between gadgets are effected by things as simple as the router not being up to date, but we tend to ignore them because typically, they work regardless.
If the problem still exists, check to see if your bluetooth is activated on your phone (i did a little google search and found that some people, for some reason, were having issues staying connected to their networks when bluetooth was activated on their phone).
If none of that remedies the issue, i would just make an appointment with Apple and see what they say, they can check down the network settings and functionality on your phone and give you a better idea of an issue (if there is one), perhaps even replacing your handset if it turns out to be some isolated hardware issue.