I was reading about this today in my toddler book! It said.....
These self-comforting activities are seen most commonly among intense children and practised most commonly at night, when these little fireballs are brimming with energy and tension that needs releasing. Comfort activities, like comfort objects, are normal in toddlers, and when exhibioted in a happy, well-adjusted child are no cause for concern.
It goes on to suggest you can set a good bedtime routine but not send them up too early, provide release with other kinetic toys like drums etc, and play lots of rhtyhmic games during the day to provide an outlet.
Stanley does this occasionally at night and I think it's because he's never had a comfort blankie or favourite teddy. Looks like it's nothing to worry about!