Depends on whether it's literally logging out, or rebooting. Neither of which would be caused by Yocto directly.
If it is logging out then that is most likely the kernels out-of-memory handler killing your entire X session to get some memory back. Turn down the parallelisation options, or buy more RAM.
If it is rebooting then this is normally overheating or bad memory, both of which are hardware problems triggered by a Yocto build being more power-hungry and sustained than just browsing the web or using a word processor.
Ross