If I were you, I would have the machine tested at an Apple Store before doing anything else with it, because it sounds like the drive is malfunctioning.
Erase and install OS X. This operation will destroy all data on the startup volume, so you had be better be sure of the backups. If you upgraded from an older version of OS X, you'll need the Apple ID and password that you used, so make a note of those before you begin.
When you restart, you'll be prompted to go through the initial setup process in Setup Assistant. That’s when you transfer the data from a backup.
If you're not sure what software was installed, select only users and Computer & Network Settings in the Setup Assistant dialog—not Applications or Other files and folders. Don't transfer the Guest account, if it was enabled.
After that, check the App Store for software updates.
If the problem is resolved after the clean installation, reinstall third-party software selectively. I can only suggest general guidelines. Self-contained applications that install into the Applications folder by drag-and-drop or download from the App Store are usually safe. Anything that comes packaged as an installer or that prompts for an administrator password is suspect, and you must test thoroughly after reinstalling each such item to make sure you haven't restored the problem.
I strongly recommend that you never reinstall commercial "security" products or "utilities," nor any software that changes the user interface or the behavior of built-in applications such as Safari. If you do that, the problem is likely to recur.
Any system modifications that you do choose to install must be kept up to date. None is required for normal operation.
Before installing any software, ask yourself the question: "Am I sure I know how to uninstall this without having to wipe the volume again?" If the answer is "no," stop.
Never install any third-party software unless you know how to uninstall it.