Is this a SATA drive (probably)? You didn't provide any specifics on the hardware.
Have you tried moving the SATA cable to a different connector on the motherboard? I know you said you tried it in another machine, so that would suggest the drive itself is the problem... but still...
Try using a different SATA connector on the motherboard, and maybe even another SATA data cable.
Pull out the data cable and re-seat it, both on the drive and also on the motherboard.
I had a recent similar situation with a Western Digital Velociraptor drive, that I thought was going bad. Like you, I would try all kinds of different ways to coax it back to "normal operation", and mostly they would work. Eventually, I decided to replace it.
I ordered a new one, transferred the contents, and it all seemed to work perfectly, pointing to the old drive as the culprit. Then two weeks later the new drive began to act up again, just like the old drive had. Grrr..
Anyway, I decided that maybe it was my SATA #4 connector on the motherboard that was at fault. So I moved the cable over to the SATA #2 connector... and it's been perfect ever since (fingers crossed that this holds true forever).