Install the Ublock extension, it will block questionable content on websites (including advertising). Install a good antivirus, I personally use Avast.
And as already written above, try not to go to questionable sites. Especially if the domain does not have https protocol.