I thought i was going crazy yesterday when some of my Windows 10 entries in C:\Windows\System32\drivers\etc\hosts file were being commented out after a while.

Turns out this happens because Bitdefender Antivirus has an option to keep resetting the hosts file, to prevent session hijacking.

To fix this, go to:

General Settings > Advanced tab > “Scan hosts file” and disable it’s scanning.