Assuming that you are running XP then right-click on My Computer, click Properties, click the Advanced tab. Under "Startup & Recovery" click Settings. Under "System Failure" untick the box in front of "Automatically restart".
The next time this happens you should see an error message. Please tell us exactly what it says.