Las Halajot de dormir
The Torah attributes significance to all of a person's daily actions and there are halachic guidelines for how a Jew should conduct himself from the time he wakes up until he goes to sleep. See a closely related topic Bedtime Shema for the halachos regarding saying Shema before going to sleep.
The Appropriate Time to Go to Sleep
- According to the Zohar, for spiritual and health reasons, it's proper to sleep in the beginning of the night and to learn torah during the second half of the night. However the Talmud Bavli and Rambam hold that it's healthy to sleep in the end of the night until Amud HaShachar.
- If one will fall asleep in prayer if he wakes up too early one can sleep later but should be careful not to miss prayer with a minyan.
Duration of sleep
- One shouldn't sleep more than 8 hours of sleep nor should one sleep less than 6 hours all according to one's needs.
Sleeping alone in a room
- One shouldn't sleep alone in a room at night. However, if there’s others in the house and not the room, one should leave the room door ajar at night (unless a man is sleeping alone in a room and the only other person in the house is a women in which case it’s forbidden to leave the door open because of Yichud.) 
- Some hold that it's enough to have the door closed and unlocked. 
Sleeping in Shul or Bet Midrash
Position to sleep in
- One should sleep on one’s side and not faced up or down. 
- One may place one's bed in any direction that one wants, however if possible it's preferable to put the head of the bed the east and the foot in the west.
- One shouldn’t sleep with one’s head or feet directly towards the door in a position that it looks like one was about to be taken out of the room.
Clothes to wear to sleep
- There is a custom to sleep with one’s Yarmalka on one’s head. See also Kippah#Wearing_a_Kippah_to_sleep. 
- There is a custom to sleep with one’s Tzitzit (Tallit katan). See the Tzizit page.
- The minhag is to allow sleeping in one’s regular daytime clothes.  However, one should remove his shoes when going to sleep. There is a discussion if the same applies to a short nap.
Sleeping during the day
- A person should refrain from sleeping during the day more than “Shitin Nishmei” which some explain as more than 3 minutes, some say a half hour, and some say 3 hours. Therefore, a person should be careful only to sleep during the day unless one needs to sleep in order to serve Hashem more effectively. 
- On Shabbat it's permitted to sleep during the day. However, one shouldn't sleep too much because it will take away from one's time to learn Torah on Shabbat.
- One who stays up all night to learn Torah may sleep during the day as is the custom by Shavuot morning.
- A person who sleeps during the day longer than Shitin Nishmei (which some say is more than 3 minutes, some say is a half hour, and some say 3 hours) should wash their hands without a Bracha. 
- No Bracha of HaMapil or Veyahi Noam is said before going to sleep during the day and no Elokei Nishama is said upon waking up. 
- Mishlei 3:6
- Rashi (Bamidbar 23:24) writes that when a Jew wakes up he should wake up like a lion in order to perform mitzvot with alacrity. This idea is also found in Shulchan Aruch 1:1. Additionally, Rashi continues, before going to sleep a Jew makes sure to say Shema and entrust his soul to Hashem.
- Brachot 3b relates the story of King David who slept in the first half of the night to wake up and learning after Chatzot. This practice of sleep in the beginning of the night is praised in a few places in the Zohar (Noach 72a, Toldot 136c, Beshalach 46a, Vayahakel 185b, Vayikra 13a). So writes the Sh"t Arugot Bosem O"C 1 that the learning at night should be done primarily after Chatzot. However, Sh"t Chatom Sofer 31 (Jerusalem 5733 edition) writes that the majority practice is learning in the first half of the night and sleeping after Chatzot. Rav Ovadyah in Sh"t Yabia Omer Y"D 7:20(2) supports this from the gemara Yoma 22a (and others) that it's preferable to stay up late learning than go to sleep early and wake up early. This is codified in Yalkut Yosef (edition 5764, vol 1 pg 75). [Halacha Brurah (Birur Halacha 1:1) writes that Rav Ovadyah's practice was to learn until after Chatzot and then sleep until morning.] Halacha Brurah (Birur Halacha 1:1) quoting the Zohar (Vayakel 195b) and Rambam (Deot 4:4) writes that either method one takes, it's proper to be awake at Chatzot to learn Torah. [Machazik Bracha 1:1 wonders why the Shulchan Aruch left this halacha out of his work leading people to be lax in this law.]
- Eliyah Rabba 1:2, Pri Megadim, (quoted by Pitchei Teshuva 1:1), Halacha Brurah 1:1
- Some sources suggest that one should sleep 8 hours such as the Rambam (Deot 4:4) and Orchot Rabbeinu (1 pg 189, biography of the Steipler). Some quote Mishna Brurah 1:9 to say that one should sleep as much as one needs, however, if you read the whole sentence, you'll see that the Mishna Brurah is saying that about someone who is weak and is afraid that if he doesn't get enough sleep he will fall asleep during davening. Baer Heitev 1:6 says the amount of sleep is subjective and some people may need more than others. Yalkut Yosef (edition 5764, vol 1 pg 64) writes that it's unhealthy to sleep more than 8 or less than 6 hours. Aruch HaShulchan says that some learn from the pasuk "Yashanti Az Yanuach Li" that one should sleep 8 because the gematria of Az is 8 and some say since the gematria (mispar katan) of Li is 4 one should sleep 4 hours, but concludes that it all depends on the health and age of the person.
- Kitzur Shulchan Aruch 71:2 writes that one shouldn't sleep alone in a room. Mishna Brurah 239:9 writes that one shouldn’t sleep alone at night alone and this includes even sleeping in a room alone. However, Shaar HaTziyun 239:17 writes that one may leave the door ajar if there are others in the house. Yalkut Yosef (Brachot pg 669, Sherit Yosef vol 3 pg 369) also holds that it’s forbidden but writes that if there’s no other option one should leave a light on in the room. Rav Mordechai Eliyahu (comments to Kitzur Shulchan Aruch 71:2) agrees.
- Piskei Teshuvot 239:6, BeYitzchak Yikra of Rav Neventzal 239:6
- SA OC 63:1 and Even Haezer 23:3 says that it is prohibited to sleep on one's back, but leaves out the prohibition to sleep on one's stomach but Mishna Brurah 239:6 says that it is a severe prohibition to sleep on your back or stomach and one should sleep on his side. Shalmat Chaim 226 says that children should be taught this at the age of nine.
- Or Letzion (vol 2 chap 1:1
- Halachically Speaking (vol 3, article 1, pg 2) quoting Rav Yisrael Belsky
- Mishna Brurah 2:11
- Mishna Brurah 21:15
- Halachically Speaking (vol 3, article 1, pg 5)
- Rabbi Eli Mansour on dailyhalacha.com, Ben Ish Chai Parashat Pinchas: Halacha 16, Kaf Hachaim YD 116:211
- see Rabbi Eli Mansour on dailyhalacha.com
- S”A 4:16 writes that a person shouldn’t sleep more than Shitin Nishmei, which the Rama limits to the nighttime. Halachically Speaking (vol 3, article 1, pg 4) writes that there's some leneint opinions about sleeping during the day but the consensus of the poskim is that one shouldn't sleep during the day unless one needs to do so to serve Hashem more effectively. Beiur Halacha 4:16 s.v. David quotes three opinions on the length of Shitin Nishmei; some say is more than 3 minutes, some say a half hour, and some say 3 hours. Mishna Brurah 4:36 concludes with a quote from the Machasit HaShekel that sleeping during the day depends on each person’s needs in order to serve Hashem. (There’s a similar conclusion in Beiur Halacha 4:16 s.v. David). Piskei Teshuvot 231:1 who writes that the halacha follows the opinion that Shitin Nishmei is slightly longer than a half hour.
- Mishna Brurah 4:36
- Mishna Brurah 290:3
- Halachically Speaking (vol 3, article 1, pg 4)
- S”A 4:15 writes that there’s a doubt whether one who sleeps during the day should wash one’s hands with a Bracha or not and so the Rama concludes that one should wash without a Bracha. Mishna Brurah 4:34 writes that this only applies if one sleeps more than Shitin Nishmei.
- Mishna Brurah 231:2, Piskei Teshuvot 231:1