It seems obvious but also: don’t drink anything with caffeine before bed and don’t eat a good couple of hours before sleep too.
I’ve had many friends who’d have a tea before going to sleep to ‘calm’ them without realising most have quite a lot still. Or guzzling down a soda too.
The DuckDuckGo browser has this baked in as ‘Cookie Pop-up Protection’. It doesn’t quite get rid of them all, and doesn’t let you set a default for what you want (it’ll basically pick the most privacy-forward option) but I’ve found it works pretty well.