The other day I had an aluminum imac that was restarting(rebooting) itself out of the blue. After a while it got so bad it couldn't even start up any longer. It would start to boot and then restart and start to boot again. So here's some Apple magic that fixed it.
Reset PRAM and NVRAM: Hold down Command, Option, P and R at boot up (hold till you hear the startup sound for the second time.
Reset SMC: Unplug the power. Press and hold the power button for 5 seconds. Release the power button. Plug it back in and boot it up.
So far, everything is fine now.
(http://support.apple.com/kb/HT1379 & http://support.apple.com/kb/HT3964)