Mum Tammy put son Tyler to bed as normal on Thursday night, but was woken several hours later by his desperate screams.

She ran into his room in their home in Macksville, northern NSW, to find a giant python latched on to his head.

The snake had crawled into the top bunk where the boy was asleep and attacked.

A family friend Craig Baker killed the snake before posting the above pictures on Facebook, where they were shared thousands of times in 24 hours.

Tyler is believed to be doing well.