Now I lay me down to sleep

I always hear the below phrases in movies. Did it come from the Bible?

Now I lay me down to sleep
Pray the lord my soul to keep
If I die before I wake
Pray the lord my soul to take

Replies