Kriyat Shema Al HaMitah
See a closely related topic Halachos of Sleep for more halachos about sleep.
Order of the Kriyat Shema Al HaMitah
- When saying Krias Shema Al HaMita, preferably one should say all 3 paragraphs but at least one should say the 1st paragraph of the Shema and then say Birchat Hamapil (unless one feels that one will fall asleep saying Shema in which case say Birchat Hamapil earlier and then Shema.) 
- If one didn’t repeat Shema after Tzet HaKochavim one must say all three paragraphs and should have the proper intent to fulfill one’s obligation. 
- You also say the ברכה of המפיל, and you add pasukim and מזמורים after it. One should follow the order of the siddur of one’s minhag. Some say that you say this ברכה before שמע, some say you say it at the end of all the תפילה. Some say that you should say it right after שמע. The Sephardic minhag is to say the Bracha before Shema. 
- If you are sick you don’t need to say the whole order of קריאת שמע שעל המטה, it's enough just to say the first פרשה of שמע and then say the ברכה of המפיל. 
- You only need to say קריאת שמע על המטה and the ברכה of המפיל once a night, so if you fall asleep and then wake up and you want to go back to bed you don’t need to say everything again.
- Birchat HaMapil should be made when one is going to sleep (one doesn’t need to wait until sleep over takes oneself) 
- Sephardim shouldn’t say the Bracha of HaMapil with Shem UMalchut unless one goes to sleep before Chatzot (midnight by halachic hours). 
Not speaking after Kriyat Shema Al HaMitah
- Once you have said קריאת שמע על המטה you shouldn’t speak, eat, or drink. Before one said the Bracha of HaMapil, if one needs to eat, drink, or say something really important there is a possibility to be lenient, and one should repeat Shema. However, if one already said the Bracha of HaMapil one shouldn’t make any interruption unless there’s a serious need. 
- Someone who wants to say the Bracha before leaving the Bet Midrash and not to say it in the room not to be bothered one may do so (but afterwards one shouldn’t make any interruptions besides going to the room and going to sleep). 
- If after one already said Birkat HaMapil one's parent asks one something and one has to answer, then it is permitted to ask because of Kibbud Av VeEm.
- Even though one should strive to say birkat hamapil as close to falling asleep as possible, if one goes to the bathroom after having said Birkat Hamapil he should still recite asher yatzar. 
Position to say the Bedtime Shema
- It's good to read the Bedtime Shema sitting or standing. If you already laid down, you don’t need to get up rather say it on your side, but it is forbidden to say it while lying on your back or on your belly, after the fact one fulfills one's obligation in any position. 
If one didn't fall asleep
- Even if one didn’t end up falling asleep the Bracha is not considered in vain because the Bracha was said about people in the world going to sleep but was established for when one tried going to sleep. 
Something to think about before falling asleep
- One should have intention that one is going to sleep in order to get energy to serve Hashem with energy tomorrow. According to some, one should verbalize this intention. 
- Before a person goes to bed it's good to consider all the things he did that day and if he finds that he did a sin he should accept upon himself not to do it again. Also it's good to forgive anyone who might have sinned against oneself. 
Text of Kriyat Shema Al HaMitah
- For the Ashkenazic text of Kriyat Shema Al HaMitah click here (from mysiddur.com).
- For the Sephardic text of Kriyat Shema Al HaMitah click here (from fxp.co.il).
- Mishna Brurah 239:1-2
- Mishna Brurah 239:1
- Mishna Brurah 239:2 writes that the people who say that you should say it before and everything else after don’t have to worry about it being a הפסק because it's all a שמירה and that isn't a הפסק. And the one who says that you say it after שמע goes like the S”A in סעיף א and then you say ישב and it isn't a הפסק because it is a שמירה. Yalkut Yosef (Brachot pg 667) writes that the Sephardic minhag is to say the Bracha before Shema.
- Mishna Brurah 239:9
- Mishna Brurah 239:3
- Yalkut Yosef (Brachot pg 664)
- Piskei Teshuvot 239:3. Mishna Brurah 239:4 says that it is מותר to speak if it is important, but once you said המפיל it is a הפסק between the ברכה and the sleeping. The רמ"א says that you shouldn’t speak rather one should go to bed right after Kriyat Shema Al HaMitah. This is also the opinion of the Yalkut Yosef (Brachot pg 664).
- Halichot Shlomo (Tefilla pg 170)
- Yalkut Yosef (vol 3, 665)
- Sh"t Yechave data 4:21, Sh"t Tzitz Eliezer 7:27, Sh"t beer Moshe 1:63 all say you still should say asher yatzar, or even Kiddush Levana or arvit if necessary.
- Mishna Brurah 239:6 writes that there are those that are more strict and make you stand but we are lenient.
- Piskei Teshuvot 239:3 based on Eliya Rabba 239 quoting the Maharitz Chayus
- Aruch HaShulchan 231:6, Kaf HaChaim 238:10
- Kaf HaChaim 231:7
- Mishna Brurah 239:9