Security. They do it to feel more secure.
2. Warmness. Also, they can sleep near your hands to feel warm and maintain their body temperatures.
3. Special Bonding and Good Health.
4. Possession.
5. Overall Well-Being. While sleeping between your legs, a pet feels loved, relaxed, and stress-free.