i came to know that discconecting from WiFi to 3G is a built-in feature in IOS 5 that enable battery save! your phone will keep listings to incoming connections from 3G (if it is enabled) and will turn to WiFi once needed, or when you unlock the screen manually to use your phone!
However, i did find a fix (at least works for me at the moment)
Connect your iPhone to your Mac/PC and launch iTunes (if it is not already launched, make sure you run latest iTunes version), once your phone is visible in the left hand side column, click on it, then in the right window you will see tabs on top (summary, info, apps, tones, etc....), click on summary and scroll to the bottom of the page until you reach options box, tick the box that says (Sync with this iPhone over wifi) and then hit apply in the bottom right corner (check any warranging message if they show up).
now you can disconnect your iPhone and close/quit iTunes.
Now your phone will have WiFi on all the time, and will be automatically discovered in iTunes once you launch it (if you want)
This is working for me. and i hope it will help you