After reciting Shema and HaMapil, whoever must talk, eat, drink, or tend to an urgent matter is permitted to do so since Birkat HaMapil is unlike Birkot HaNehenin, concerning which it is forbidden to interrupt between the berachah and the pleasure derived. Rather, it is a berachah of praise on the night’s sleep. However, l’chatchilah, it is best to recite the bedtime Shema immediately before sleep (see Rama 239:1; Tzitz Eliezer 7:27; Yechaveh Da’at 4, pp. 118-122; Piskei Teshuvot 239:3; however Mishnah Berurah 239:4 is stringent after HaMapil).
One may recite the passages of the bedtime Shema while lying down, but he must be careful to lean on his side. There are a number of reasons why the Chachamim prohibited a man to sleep while lying on his back (Mishnah Berurah 239:6). However, before one’s sleep, a man is permitted to read a book while lying on his back and it is unnecessary for him to turn on his side. Only when he is about to fall asleep must he beware of lying on his back (Az Nidberu 6:50).
The Ba’alei Mussar (Jewish ethicists who composed books of reproof for the nation) wrote that it is good for a person to make a personal accounting (cheshbon nefesh) before sleep. If he remembers sinning, he confesses his sin and takes it upon himself not to sin in that manner again. It is also proper that before going to sleep, every person forgives anyone who sinned against him or caused him harm, so that no one is punished because of him. By doing so, one merits long life (Mishnah Berurah 239:9).