What version of OS X are you running?
Wifi problems seem to crop up a lot on here and unfortunately there doesn't seem to be a 'one fix' solution.
However, sometimes any one of the following can help although, unfortunately, not always. In no particular order:
- Check wifi security - if it's WEP change it to WPA or WPA2 (preferably, as it's more secure)
- Change the wifi channel on the router
- Create a new Network Location: http://support.apple.com/kb/HT5289
- Reboot the router
Also take a look at this link and the links within the article for other ideas. They mainly reference Lion, but still seem to be relevant to Mountain Lion:
...and this link: