Xcode auto-quit in Mountain Lion
According to OS X Daily, you can disable auto-terminate in Lion and Mountain Lion with the following terminal command:

defaults write -g NSDisableAutomaticTermination -bool yes


This sets the NSDisableAutomaticTermination flag in the defaults database that OS X consults to get various settings.

Note that this will disable automatic termination for all applications, not just Xcode.