- Use a power supply that can deliver enough current
- Use good USB cables that can actually carry said current (a lot of people miss this one)
- Do not use cheap SD cards
- Oversize your card so that the card can properly perform wear-levelling.
I have a pair of Raspberry Pi's (2's and/or 3's IIRC) running constantly since 2015. They're running an ancient version of Redsleeve (and are on my list to rebuild but never mind that). DNS, DHCP, and a few other services run on them. They've also survived multiple abrupt powerfail events.
They log to the SD card, and yet I've never had a problem. I personally believe that the fact that I'm using oversized cards with gigabytes of free space is the key. Well, perhaps that and the fact that my personal home directory is on NFS.
Or maybe I'm just lucky? Who knows...