Get a surge protector. Better yet, get a UPS (Uninterruptible Power Supply), sometimes known as a battery backup unit. It will protect your computer and may keep your data from becoming badly damaged if there is a power failure. It doesn’t hurt to connect your other sensitive electronic devices to these either. Just don’t overload them.