1. I followed RTLFTB's suggestion in: http://www.computing.net/answers/windows-xp/xp-restarts-coming-out-of-standby/44526.html

[More then likely the system is encountering an error but it is set to restart itself.
Go to Sart - Control Panel - System - Advanced Tab. Under the Startup and Recovery section click the Settings button. Under the System Failure Category uncheck "Automatically Restart".
This won't fix it but instead of restarting automatically it should at least display the error on the screen and allow you to see what is causing the problem.]

This probably didn't fix the problem. But maybe will help more problems in future.

2. I noticed computer would do fresh restart when bringing it out of standby by using my keyboard. However, the computer would proplerly come out of standby when using the power button on my computer. So now I just use the computer's power button instead of the keyboard. I also unselected "Allow this device to bring the computer out of standby" under control panel -> keyboard properties -> power management.