There are a few places you can start. I would install mtr and screen (available via apt-get):
http://www.bitwizard.nl/mtr/
Then login to your router and setup two screen sessions. One mtr to a local box on your local network, the other an mtr to some reliable internet site like google.com. Let these run. Then the next time you see an issue reattach to the screens and you should see mtr showing '?' where there is packet loss. It will probably be on one side (either to google, or to your LAN). If the issue is on your local LAN you need to investigate possible failures with hardware or cabling. If it is wireless like @David Schwartz asked you may need to investigate SSID or frequency problems.
If for some weird reason both mtr's show loss there may be an issue with your box and you should look at the logs in /var/log and 'dmesg' for possible answers.
If neither of the mtr's show issues when you experience the problem it is probably DNS related and you should either try setting up your own caching DNS server or using OpenDNS or google as a resolver to see if that improves the problem (nameserver 8.8.8.8 or 4.2.2.1 on /etc/resolv.conf should work).