See if you can figure out any pattern to it. Monitor the 5VSB rail with a logging multimeter or scope.
Consider what seems most likely, failing UPS, failing PSU, or less likely, failing motherboard. Once in a great while, I read of someone even having oddball problems from the case front panel, on/off switch failing.
Is it possible you are simply having power brownouts for longer than the UPS can keep it powered?
Back to the original post, you wrote "last time I lost my data", but why wouldn't you have saved your data before stepping away and letting the PC sleep in the first place? That is unless you mean that you had filesystem corruption but that should not happen while the PC is asleep, unless what is really happening is that HDD or SSD is failing or has a bad cable/connector/something, OR you had instability while the system was awake too and that caused corruption.