I recently discovered that the two iPhones (a 3GS and a 4S) in my household were both deferring to using 3G and 4G instead of using Wi-Fi. All the other devices (two laptops, one iPad 2, and two Direct TV boxes) were doing just fine.
I looked all through many tutorials online and tried a number of weird tricks and resets and was getting pretty flustered about it. Then I looked into why it would be affecting out phones and not our other devices and found this:
Pre-iPhone 5 models do NOT support the newer 5GHz Wi-Fi spectrum. All the other devices in my house, including the iPad2, DO support the 5GHz Wi-Fi spectrum. This means that the only devices using the 2.4GHz range on my router were the two iPhones.
I logged into my router's control panel to have a look at the 2.4GHz settings. At first I was considering changing its security settings from WPA2 to WPA Enterprise, but first I decide to try something simpler. I changed the 2.4GHz channel setting from "Auto" to a dedicated channel, and everything was back to normal.
I wish I could provide an explanation for why this worked. It seems there are many of people having this issue. I hope this helps you if you are.
[kirkmc adds: It is entirely possible that there was interference from other people's routers on the channel you were using. By changing the channel, you found one that is less encumbered. But this is certainly something to try if you are having Wi-Fi connection problems, and not just with an iPhone
5GHz is not really "new," it's just not been supported by mobile devices for very long. I've had a 5GHz network in my home for a few years, even though, for a long time, only my Macs would connect to it.]

