KRI'AS SHEMA AL HA'MITAH [Kri'as Shema Al ha'Mitah]
GEMARA
The Leviyim sing from "Yoshev b'Seser Elyon" until "Elyon Samta Me'onecha" (and "b'Varcho Mipenei Avshalom Beno" (Tehilim 3) - Gra deletes this).
R. Yehoshua ben Levi would say these verses before going to sleep at night.
Question: He himself said that one may not use words of Torah to heal himself!
Answer: One may use words of Torah for protection.
Berachos 5a (R. Yitzchak): Anyone who reads Shema before sleep is like one who bears a double-edged sword (to kill Mazikin) -- "Romemos Kel bi'Gronam v'Cherev Pifiyos b'Yadam."
(Mar Zutra): We know that the verse refers to Keri'as Shema, for before this it says "Yalzu Chasidim b'Chavod Yeranenu Al Mishkevosam."
(R. Yitzchak): Mazikin avoid one who reads Shema before sleep -- "u'Venei Reshef Yagbihu Uf."
Verses teach that "Uf" is Torah, and "Reshef" is Mazikin.
13b: One may not say Kri'as Shema lying down, even if he leans a bit to the side.
Question: R. Yochanan would say Shema this way!
Answer: He was fat (it was hard for him to turn totally onto his side, therefore he was permitted to lean slightly).
24a (Shmuel): If two are sleeping (naked, under a blanket) on a bed, each may turn his head away to say Keri'as Shema.
Megilah 28a: One of the merits to which R. Nechunya ben Hakanah attributed his long life was that he would not sleep before forgiving one who had cursed him. This is like Mar Zutra. Before Mar Zutra went to sleep, he would forgive all who pained him.
RISHONIM
R. Yonah (15a DH Shnayim): Why do we permit two sleeping under one garment to turnaway from each other and say Shema? One may not say Kri'as Shema lying down, even if he leans a bit to the side! The Heter to lean is while sitting, not while lying down! We can say that the Isur when lying down and leaning is when lies on his back and leans a bit to the side. If one turns totally on his side, it is permitted. A better answer is that we find that when it would be an exertion (to sit up), it is permitted, like for R. Yochanan, for he was fat. Here also, since he took off his clothes, it would be an exertion to get dressed again (to say Shema sitting), so he may read leaning.
Beis Yosef (OC 239 DH ucheshe'Yirtzeh): R. Yonah permits to say Shma while leaning only if it is an exertion to get up. He cannot explain 'Al Mitaso' to literally mean on his bed. Rather, it is shortly before sleeping. Rashi, the Rambam and Tur permit when one is totally on his side. They can explain that he is lying on his bed.
Rambam (Hilchos Kri'as Shema 7:2): One reads the first Parshah of Shema and goes to sleep. If he is overcome by sleep, he reads even the first verse or verses of mercy and then sleeps.
Rosh (Berachos 9:23): R. Chananel says that one must say also Parshas "v'Hayah Im Shamo'a", for it says "when you lie down and rise." Perhaps the text of the Gemara is 'one says Shema and "v'Hayah Im Shamo'a."
POSKIM
Shulchan Aruch (OC 63:1): One recites Shema walking, standing, lying, riding on an animal, or sitting, but not lying face down or on his back. He may read leaning to the side.
Rema: This is because he is already lying, and it is an exertion to stand.
Shulchan Aruch (ibid): If he is very fat and he cannot turn on his side, or he is sick, he leans a little and reads.
Shulchan Aruch (239:1): One reads Al Mitaso the first Parshah of Shema and blesses 'ha'Mapil Sheinah...'
Magen Avraham (1): R. Yerucham says, based on Medrash Tehilim that one should say all of Kri'as Shema, which has 248 words, to guard his 248 limbs.
Mishnah Berurah (1): If is good to always say all three Parshiyos, which have 248 words (with Kel Melech Ne'eman) to guard his 248 limbs.
Kaf ha'Chayim (1,2): We should say all 248 words. Chasidim Rishonim did not need to say more than the first verse. He repeats 'Hashem Elokeichem Emes' to complete the 248 words.
Magen Avraham (2): Only Shema and ha'Mapil are a Chiyuv, but not the Tehilim. R. Yehoshua ben Levi himself said only two Tehilim. One who is sick or Anus is exempt. Women do not say Kri'as Shema Al ha'Mitah. Perhaps this is because it applies only at night.
Rebuttal (Eliyahu Rabah 4): Sifrei Musar say that also women must say it, for it is for Shmirah (protection). Also they need this!
Eshel Avraham (2): Those who exempt hold that Kri'as Shema Al ha'Mitah is for the sake of (Divrei) Torah. Nowadays, the custom is that women say it.
Kaf ha'Chayim (3): Just like men need protection from female Shedim that can cause emissions, women need protection from male Shedim that can defile them.
Rema (ibid.): See above (63:1) whether one may read while lying.
Magen Avraham (5): This is for the Chiyuv Kri'as Shema. If one was Yotzei already and reads just for Shmirah, he may lie. We find that R. Zeira read repeatedly until he fell asleep. (Surely, he was lying down.)
Mishnah Berurah (6): It is clear there in the Rema that l'Chatchilah one should not lie down to read while lying, even if he turns on his side. Some are stringent to stand or sit even if they were already Yotzei Shema. If he is already lying, all agree that he may lean on his side and read. One should accustom himself to lie on his side. It is a great Isur to lie face down or on his back (lest this lead to erections and emissions).
Kaf ha'Chayim (11): Even if one already was Yotzei Shema, Kri'as Shema Al ha'Mitah is obligatory. One should say it with great Kavanah.
Mishnah Berurah (5): If one will have relations, afterwards he cleans himself from semen, washes his hands, and recites at least ha'Mapil and Shema.
Kaf ha'Chayim (10): One may say Shema and bless before relations. It depends on the person (if he will be able to say Shema and bless later).
Beis Yosef (DH v'Chosav): Rabbeinu Meir would read "vi'Hi No'am" before going to sleep during the day.
Mishnah Berurah (8): During the day one does not bless ha'Mapil. It is good to say "Yoshev...","vi'Hi No'am..."...
Mishnah Berurah (9): At night, before sleep, it is proper to investigate what he did during the day. If he finds a sin, he should confess and resolve not to repeat it, especially common sins such as fattery, lying, Lashon ha'Ra. Bitul Torah requires great investigation. It is proper to pardon anyone who sinned against him or pained him. This is a merit for long life.
Kaf ha'Chayim (2): One says 'Ribono Shel Olam...' (and forgives all who pained him) before Kri'as Shema Al ha'Mitah. One does not say it on Shabbos or Yom Tov.