In my family, I'm sure my mother taught it to us, but with a slightly different wording:
Now I lay me down to sleep
I pray the Lord my soul to keep
If I should die before I wake
I pray the Lord my soul to take.
I was an adult before I realized that teaching a young child that he or she might "die in their sleep" probably isn't the most calming thing to do. I still pray nightly and in the morning but not that so-called "child's" prayer.
I didn't teach that prayer to my son, either. I told him to pray as if he was speaking to God as if God was there with him.