When you say it stops working:
1) It will not power on? In this case this is obviously an electrical problem, the drive is defective and you should stop trying to use it. If it is still under warranty send it back for replacement.
2) The operating system is not working-the computer can't find an OS and hangs there. In this case you just need to go to BIOS and change the boot priority, select the hard drive with your OS, save settings and reboot.
You need to be more specific with what you had, what you have and what you want to do with your system.