Disallow some websites from opening new tabs/windows
The best built-in defence for this is Safari Preferences → Security → Block pop-up windows. Other than this, you can use an adblock such as uBlock Origin.