Start > run > msconfig > startup tab > take out any 3rd party programs. Anything that isn't core OS.
That should lighten the load, and make it bootable.
That or you have bad ram... but if you can get it booted, try that. Because you said ''sometimes'' so keep trying to get it booted.