I'm not sure the reason for this, maybe it's a comfort thing?
I know my baby niece always does this, and you can right away tell that she's ready for a nap.
It sure looks cute, at any rate!
It's actually amazing when you think about it how many babies do this, or play with their hair.