I can confirm what DavidR has said about this problem that it can occur even without Avast!, although it may be a case an aspect of Avast! can be agitating this problem of randomly losing internet connections and yes it is being both discussed here and looked into by Avast!.
I don't recommend disabling the Avast! Web Shield strait up, but may be only as a last resort.
@aldz Since this can happen without Avast! I assume it is something happenning with your Windows 7 OS, personally I blame MS.
However Windows does provide a few tools to try and get things working again in these situations even though it seems no one is exactly certain about the problem.
You can troubleshoot your network connection and home group by Opening Network and Sharing Center and in the central list at the bottom is "Troubleshoot Problems", click on it to get to that and you'll see a few things you can do. Of them the 3rd one, "Homegroup" I find the most effective to use in resolving this problem, although I also do the first one, "Internet Connections' and the forth one, "Network Adaptor" if "Homegroup" fails to.
I suggest right clicking "Homegroup" in Troubleshooting Problems and choose to run it as administrator and on the Homegroup pop up window click Advanced (written in blue) to apply fixes, shortly after running a few seconds it will stop and ask you if you want to "Troubleshoot Network Problems" and yes click on it to do that also.
You might have to do this several times to finally get it to correct things and allow you to connect to the internet, if it doesn't there are several other things you can try to do.
I'll tell you my next thing and that is from the Network and Sharing Center screen, in the top left corner click on "Change adapter settings" which will show you an image icon of you LAN or WLAN connection, now right click on that and on the drop down menu pop up click on the top option "Disable" and it will disable your Local Area Connection. After a moment right click on the image icon again and choose to "Enable" LAN connection. Right click on the image icon again and choose "Diagnose" or if it isn't there "Status" and on the pop up that comes up click on the "Diagnose" button, sort of bottom right IIRC.
After that diagnostic runs it may have fixed the connection, but not your Homegroup setting, so usually I troubleshoot the "Homegroup" again as above, may be twice! After all that I check that the internet is connecting by going back to the Network and Sharing Center and clicking on the "See full map" (written in blue top upper right of screen) and it should only take a moment to create a diagram of your LAN Network connection in a tree, if it doesn't and says that it can't create it or cannot find any device you'll have to try and do all of the troubleshooting again or just give up and shutdown and reboot your computer.
There is one thing in Avast! that seems to help prevent this loss of internet connection from happenning and that is to open Avast! go to Web Shield, choose Expert Settings and put a tick in the box for "Scan traffic from well known browsers only", but while it slightly reduces your protection, there are other parts of Avast! that should hopefully pick up any of the slack. This is the best thing you can do with Avast! to try to prevent this problem at the moment, but as I said this isn't entirely a problem caused by Avast! it is a Windows 7 issue, that may be a hangover from Vista at least that is what stuff I read at Microsoft community help boards say about this problem.