Use your admin account for app installations. Admin privileges are necessary for drive by downloads to install without your consent. Use a second non-admin account for daily use.
Keep browser and operating system up to date. New patches help seal gaps in defenses. Install immediately when released.
The more code on the device, the more susceptible it is to infections. Prune often. Only keep what you trust and use often.
Use a firewall and virus scanner on a PC and an internet security software solution on phones.
Avoid websites that may contain malicious code. Sites that offer file-sharing or mature content are common points of infection.
Carefully read and examine security popups on the web before clicking. Scammers use deceptive popup ads on desktop and mobile browsers that look like legitimate alerts. Watch for typos, odd grammar, and grainy images.
Use an ad-blocker. Drive-by download attacks often use online ads to upload infections. Using an ad blocker can help reduce your exposure to this type of attack.