I'm on Windows 7.
This happened to me recently and I thought I fixed it although I tried so many things I wasn't really sure how I did in the end.
A week went by and today I had the same issue. This is what I FINALLY did and so far so good.
I went to > control panel > device manager > network adapters > find one that lets you right click and hit properties > Power Management tab > uncheck computer can turn off this device.
In my case it was Microsoft Virtual Wifi Miniport Adapter and I checked the driver and it needed an update. After a restart the problem continued.
So I went to the same place right clicked it and disabled it and now everything is working very well. I also set Avast to the original settings just in case. I had also read that certain settings may cause an issue.
Since I thought I had this fixed before, we'll see if it comes back. If so, then this blog is to be continued. If not continued then - SUCCESS.