I'm not sure why they do this, but Penny does it every night when she's falling asleep. Lately, she's also taken to thrashing her tail on the bed at the same time. LOL
As a puppy, Spud's sleep panting was so severe we tried to video tape the events and show the vet. Neither of us had ever seen such rapid, shallow breathing. It woke us up at night. He eventually outgrew (?) these episodes.
Cooper used to do that when we put her in her crate at night when she was little - turns out she was too hot so we removed the blanket, then she slept fine