Baby shaking or moving his head

So my baby is approaching 7mo in another 1 week's time. Lately, I notice when I lay my baby down to bed at night, he will shake or move his head up & down, he do this before he finally fall asleep, and apart from that, he kept on swallowing 🤔 like is he swallowing phlegm stuck on his throat?