I'm going to suggest you go to a site that has wi-fi and try the phone there. Obviously if it has the same issue at other wi-fi sites then we know it's the phone. If it doesn't then it's most likely the router (They can go bad).
I'm not sure what type of wi-fi your router supports, N type routers are the most powerful. Here is what Wikipedia says about wifi range:
"Wi-Fi networks have limited range. A typical wireless access point using 802.11b or 802.11g with a stock antenna might have a range of 32 m (120 ft) indoors and 95 m (300 ft) outdoors. IEEE 802.11n, however, can more than double the range.[39] Range also varies with frequency band. Wi-Fi in the 2.4 GHz frequency block has slightly better range than Wi-Fi in the 5 GHz frequency block which is used by 802.11a and optionally by 802.11n. On wireless routers with detachable antennas, it is possible to improve range by fitting upgraded antennas which have higher gain in particular directions."
This is what Wikipedia says about Interference to wi-fi:
"Wi-Fi connections can be disrupted or the internet speed lowered by having other devices in the same area. Many 2.4 GHz 802.11b and 802.11g access-points default to the same channel on initial startup, contributing to congestion on certain channels. Wi-Fi pollution, or an excessive number of access points in the area, especially on the neighboring channel, can prevent access and interfere with other devices' use of other access points, caused by overlapping channels in the 802.11g/b spectrum, as well as with decreased signal-to-noise ratio (SNR) between access points. This can become a problem in high-density areas, such as large apartment complexes or office buildings with many Wi-Fi access points.
Additionally, other devices use the 2.4 GHz band: microwave ovens, ISM band devices, security cameras, ZigBee devices, Bluetooth devices, video senders, cordless phones, baby monitors, and (in some countries) Amateur radio all of which can cause significant additional interference. It is also an issue when municipalities[42] or other large entities (such as universities) seek to provide large area coverage."
Maybe some of this will help.