A recommendation from the FBI:
Use an ad blocking extension when performing internet searches. Most internet browsers allow a user to add extensions, including extensions that block advertisements. These ad blockers can be turned on and off within a browser to permit advertisements on certain websites while blocking advertisements on others.
Using an ad blocker is good advice. However, given that many browser extensions have broad permissions and many ad blocking extensions are proprietary, for profit, and have ill-defined privacy policies, this is one case where the cure can be worse than the disease. I personally recommend uBlock Origin, which I use on my primary browser to block scripts as well as ads. AdGuard’s browser extension (not to be confused with its desktop adblock software or DNS server) is another great choice. For those who do not want the hassle of extensions, the open source Brave web browser has good and configurable built-in adblocking functionality, although you will want to take a few minutes in the browser settings to disable some of Brave’s annoyances. Advanced users may also consider host-level blocking, which I employ on all of my computers with hBlock and on Android (LineageOS) via AdAway (root required).