There are really only two things that you need to do to block all ads and malware when browsing the web.
Let me clarify when I say malware I am not only referring to malicious software, but also cross site vulnerabilities and click jacking amongst other possible attacks.
1. Install NoScript in your FireFox browser. This takes care of most of the malware part. It also will speed up your browsing experience since you are not running unnecessary JavaScript on every page, say Google Analytics for example.
2. Update your hosts file with this one: http://www.mvps.org/winhelp2002/hosts.htm. This hosts file not only blocks ad servers, but also servers that host malicious software. Another benefit is that you will browse the web faster since you will no longer be making extra requests to ad sites.
I really enjoy the hosts file as it means that when I watch hulu I no longer see any advertisements. How cool is that, free tv shows free of advertisements.