Many of these infections require a degree of complicity but the user. The most common reason for getting hit is being duped into doing something, social engineering, opening a link to some unbelievable offer, etc. here you need a healthy dose of common sense and suspicion.
Some can be just bad luck arriving at a site that has been hacked and you get hit by a driveby download. But for the most part your security software and proactive measures show go a long way to protect you, but nothing is 100% and now you need a backup and recovery strategy (hard disk imaging software).
Avast’s web shield and network shield provide good protection against hacked sites and known malicious sites and the script shield against malicious scripts, but as mentioned nothing is 100%.
So you have to have pro-active measures, do you run your browser sandboxed, do you run it with limited rights, both of these could help limit the potential damage should you get hit. You can go a step further in your choice of browser and the security add-ons for it, e.g. Firefox with NoScript (helps prevent driveby download as they are usually script tags to run them) or NotScript for Chrome, that blocks all scripts unless you specifically allow it on the site.
Other add-ons: AdBlockPlus, whilst many think how will blocking ads help against malware, well it also has lists that can be added for Malware domains. RequestPolicy (firefox add-on), this is like NoScript but for Cross Site Scripting, which is commonly used in driveby downloads, a link in the site you are visiting has a link to another site (the cross site bit) to run a script to handle the download, etc. So like NoScript you have to explicitly give permission for 3rd party sites to run scripts or import data, etc.
The RequestPolicy add-on is more intrusive than NoScript and may not be acceptable for everyone, but NoScript has a basic cross site scripting block, so that would still help against cross site scripting.
HIPS as mentioned helps, many firewalls come with HIPS functionality built in (mine does), but some can be very intrusive. There is also WinPatrol which is very handy for prevention of unauthorised changes to system settings, etc. The plus version is better and that is a one off subscription.