(This should not be relied upon for practical halacha. When a question arises a Rabbi should be consulted.)
1. The Gemara in Shabbos (151b) states, “Rav Chanina said: It is forbidden to sleep alone in a house, and whoever sleeps alone in a house will be seized by Lilith (Lilith or Lil’ is the mother of demons- Zohar, Pekudei 276b).” Interestingly, there is an earlier source for this prohibition. The great Tanna, Rav Eliezer Hagadol, writes in his last will and testament, “My son make sure not to sleep in any house alone at night since this can cause one to be seized by Lil’ and once Lil’ seizes a person or a child she removes them from this world.” (Orchos Chaim 59) This law is cited by the Shulchan Aruch Harav (Shemiras Haguf 6), Magen Avraham (239) and the Mishna Berurah (239).
2. The Rif and Rosh have a slightly different text of the Gemara. According to their version the Gemara is forbidding sleeping alone in a house at night. Sleeping during the day would be permissible. Virtually all of the later-day authorities rule in accordance with this view (Eishel Avraham 239, Shulchan Aruch Harav, Mishnah Berurah). The Machatzis Hashekel adds that even according to the standard edition of the Gemara (not that of the Rif and Rosh) the prohibition only exists at night.
3. The commentaries make note that the Zohar (Tazria 45a) seems to forbid sleeping in a house alone even during the day. The only distinction between the day and night, according to the Zohar, is that sleeping during the day is only a problem in a house that is distanced and secluded from other homes. While at night it is a problem even if the house is close to other homes. (see Sdei Chemed vol. 4 page 525, vol. 9 Divrei Chachamim 85) [A baby in a crib should not be left alone in the house during the day or night. (Orchos Chaim 48)]
4. The Gaon of Butchetch writes that the problem is sleeping alone, however, one may take a nap alone at night.
5. The Gaon of Butchetch continues that “perhaps this law does not apply to women and they may sleep alone at night.” However, the Kaf Hachaim (239:17) maintains that the prohibition applies to women as well.
6. The Magen Avraham writes that one may not sleep alone in a room even if there are others in the house and the adjacent rooms. This is also the view of the Mishnah Berurah.The Sdei Chemed proves that this is indeed the view of the Rif.
The Mishnah Berurah (Shaar Hatzion 239) writes that therefore if there are others in the house and not the room, one should leave the room door ajar at night. If a man is sleeping alone in a room and the only other person in the house is a women in which case it is forbidden to leave the door open because of yichud. Rather, one should lock the door and since he is performing the mitzvah of avoiding yichud he need not worry about any danger.
According to the Mishnah Berurah if one is sleeping alone in a room and there are other people in the house one should leave the door ajar to avoid any hallachic problems (assuming this will not lead to the prohibition of yichud). The Komarna Rebbe writes that in case of need one may rule leniently as long as he leaves the “door wide open.” (Shulchan Hatahor 241:10) The Chelkas Yaakov (O.C. 57) and Harav Neventzhal shlit”a (Biyitzchak Yikarei) maintain that one may rule leniently even if the door is closed as long as it is not locked.
Other poskim maintain that the entire prohibition exists if one sleeps alone in the house. However, if there are others in the house, even though there is no one else in the room, it is permissible. This is in complete disagreement with the Magen Avraham and Mishnah Berurah. The Sdei Chemed writes that this the view of Rav Moshe Ashkanazi. This view is also cited by the Aruch Hashulchan. Rav Yosef Shalom Elyashiv zt”l is also cited as ruling this way (see Shilhi Dkayta 53).
7. Many poskim, including the Sdei Chemed, Kaf Hachaim, Gaon of Butchetch and Rav Gershon Henoch of Radzin, maintain that if there is a light in the room (either electric or clear strong moonlight through the window) there is no prohibition. Similarly, someone asked the Debriciner Rav (Beer Moshe 3:45) what should he do during the summer when his family is away in the summer home and he is alone. He answered that if he keeps a light on his room (or there is light from the hallway) it is okay to sleep alone since the gemara in Brachos says (43b) that a fire is equivalent to another person. Furthermore the Yerushalmi (Shabbos 2:6) adds the word “dark” house. Therefore leaving on a light would resolve the issue. The Chazon Ish, however, feels that having a light on does not permit sleeping alone (Dinim VHanhagos Chazon Ish page 57).
8. The Gaon of Butchetch writes that perhaps one may rule leniently if there is a Mezuzah on the doorpost. The Mezuzah protects those inside of the room from demons. The Gemara which prohibits sleeping alone was discussing homes without a Mezuzah (that of a non-Jew). However, the Kaf Hachaim and Harav Binyamin Zilber zt”l (Birur Halacha 3:239) do not agree with this ruling.
9. According to the Gra (Maaseh Rav 221) and the Dovev Meisharim (79) one may sleep alone in a Sukah. Since sleeping in a Sukah is a mitzvah one need not concern about danger.
10. The Shu”t Binyan Olam (Y.D. 62) writes that just as one may not sleep alone in a house, one may not sleep alone outdoors in a slightly deserted area. He adds that there are more demons in a field than indoors, therefore sleeping in a field is even worse than sleeping alone indoors.
If you have a question, comment, or an idea for an article please email me at email@example.com.