So, I am having the same problem, but under different circumstances. First off, I have had this 3GS for a year with no wifi issue like this.
It unlocks and connects to wifi fine.
After a few minutes or even up to an hour, safari no longer loads pages, itunes remote loses it's connection to iTunes; airmouse no longer connects to computer, but I still have wifi signal indicator in the menu bar. What's extremely frustrating is that I paid $2.11 for airmouse, an amazing program, so I could use my comp from the other room on the big screen. Now when wifi dies, program crashes and I have to go into the other room to kill the desktop app. Bug is not apples fault, but the wifi is.
Here is my setup:
Same router password for 1.1+ years.
-no recent firmware updates, no changes made for months. ( i moved in june , got new cable modem, changed ssid, but kept all other things the same. It has been flawless since then and before that since I bought it new.
Here is the other weird thing, this started at work on a wrt54g (rev3 I believe) and that boots me off and the iPhone loses the password. My netgear here boots me off but the iPhone says it's connected.
I reset all network settings to no avail. I recently upgraded to 4.3.5
To fix it temporarily, I found that I can turn off wifi for 1-2 seconds, then turn it back on. It finds my network even!
TL;DR
wifi fine for one year, Same router, no changes. Upgrade to ios4.3.5 and all of a sudden won't connect.
On linksys wrt54g at work, same thing but loses password also.