Check in Properties of 'My Computer', Advanced tab, Settings button in the Startup and Recovery section. Remove the tick from 'Automatically Restart' in the System failure area.
The reason for doing this is because if your PC suffers a problem when shutting down then this setting will make it restart. If this is the cause then you may now get an error message to help in tracking the problem.
If this doesn't help then it may indeed be a problem with your switch although without some vibration or a knock to trigger it then it is doubtful. If the power switch sticks in then this usually results in the PC shutting down within about 2 seconds of being switched on.