the vent holes could be clogged with dust.
Likely that's the issue, and likely it is your PSU. When the CPU or main board over heat you'll usually get a blue screen of death. When the system just shuts down without warning, as if you lost power, it's the PSU 9 out of 10 times.
Since your PC is older, you'll need to make sure you get the right PSU to replace it. They are harder to find, but not that hard. I'd expect to pay about 75 to 100 dollars depending on the wattage you want.
I'm glad it's working for you. Hopefully it keeps on working. Current is a great conductor for dust, which is why those things get clogged.