Reading this and the other posts on Wifi problems is disturbing. My iPhone 3G is on firmware 3.1.2 so not sure that reverting back to 3.1.2 will help as I have the same problems. It also appears that 3.1.3. will exacerbate the problem. Sounds like its time to harass Apples Support staff and developers to get a proper resolution to this issue as this problem is starting to really irritate.
I use a Netgear WNDR3700 wifi router at home. It has support for all bands. At work I use a Belkin router (exact model not remembered) I see the same problems. At my mates house with another Netgear router (DG834G) I see the same problem.
Until the last few weeks I can't say I've had any problems with WiFi on my 12 month old iPhone 3G (firmware 3.1.2 (7D11). However, these last few weeks this phone just can't stay connected to WiFi networks for any great period of time; sometimes minutes, sometimes seconds.
I've tried manually adding wifi networks following hints from other users on the forums, but this doesn't work reliably.
I've now done a full reset of the network element based on advice in Apple's own iPhone WiFi troubleshooter. I'll see how that goes.
http://www.apple.com/support/iphone/assistant/wifi/#section_5
I don't believe this issue will be resolved without Apple's action, so come on Apple please help us. We love our iPhones, just don't like to see issues with them!