OK this is two problems. The first problem is that your hard disk does not sound like it's in a good way so run Scandisk (or wichever one you use) and do a surface scan to get rid of those physical errors. Take note of the files that might have been damaged and replace straight away.
The second problem (the computer restarting) will either be fixed by the above or there is a program that loads up at startup and crashes your computer, causing it to restart. Check your startup folder or regestry for any programs you do not need. If that does not work then disabe the lot and turn them on one by one, checking to see if everything works o.k.