Avoid bad neighborhoods
On the Web, as in football, the best offense is a good defense. The #1 way to avoid getting malware is to be careful about the websites you visit. For instance, sites that let you watch videos or play games for free or download free software are notorious sources of malware.
Know in advance if a website is sketchy
One extension we would never browse the web without is Web of Trust (WOT) (https://www.mywot.com/). WOT, free and available for all browsers, uses "reputation icons" to tell you at a glance which websites you can trust, based on crowdsourced ratings. If you try to go to a site with a bad reputation, WOT will warn you, tell you why, and give you a chance to escape unharmed. (Disclaimer: We are not affiliated with WOT in any way.)
Subscribe to a malware filter list
AdBlock includes a filter list called Malware protection that can block downloads from sites that are known to host malware. This filter list should be turned on by default when you install AdBlock. You should confirm it's enabled, just in case.
If you want to disable it for some reason, you can do that in AdBlock's options on the "FILTER LISTS" tab. You can also turn on the option to have AdBlock notify you if it detects malware. If you do, please note that this is a beta feature and may not be quite ready for prime time.
Always use an antivirus and an anti-malware application!
And of course, the best defense is a good offense! Always, always, always use an antivirus program. You can find reviews and recommendations for good free antivirus programs using your favorite search engine.
In addition, keep an anti-malware program installed to scan your computer when you think you might have picked up malware. We recommend Malwarebytes Anti-Malware. (Disclaimer: We aren't affiliated with Malwarebytes in any way. We've just found that their software tends to find malware that others miss, it's available for both Macintosh and Windows computers, and it's free.)
Advice for particular browsers
Apple Support has some advice on how to stop pop-up ads and adware in Safari.
Google has suggestions for how to stop unwanted pop-ups or homepage changes in Chrome.
Malwaretips.com has a comprehensive guide to removing malware from Microsoft Edge.
Learn more about malware
Here are some good places to learn more about what malware is and how to avoid getting it:
How to easily avoid PC infections (Malwaretips.com)
Protect your computer from malware (Federal TradeCommission)