SD card wearing out and improperly shutdown device are the two main causes.
You can dial down the Pi logging to reduce wear on the cards, especially useful if using small media cards.
For power down corruption, a UPS HAT to handle improper shutdown in the event of impromptu power shutdown - it will detect power failure and shutdown gracefully and restart when power restored. A very worthwhile £30 or so iirc. Mine appears to be a slightly older version of
UPS PIco - Uninterruptible Power Supply (HV3.0B+)– The Pi Hut - just watch the size of any battery and case - I got the more limited slimline battery which is good for a brief outage before having to safely shut everything down - not a problem as I was logging solar which needs power on to run plus router would be out anyway.
The other suggestion is to take a zipped image backup of the whole media card and store the image away somewhere. So when the inevitable does happen, a new media card can be easily restored. Obviously a additional backup strategy is needed for any persistent data that may be stored. I log to an external repository so max I have to lose is 5 minutes of data.
My current Solar monitoring setup has been running this setup 24/7 since early 2014 and has been very reliable although I did swap out the card early on due to power supply failure corruption - thats when I went with the UPS HAT. Only gets a reboot when we have a sustained power cut - ironically some issues getting the Tesla home charging put an end to its longest uninterrupted run of a month shy of 2 years.