Davey Paxton, 23, used an aerosol deodorant can and lighter to target Connor Gammer, 20, while staying at a friend's flat after a night drinking.
Mr Gammer was "terrified" when he woke to find his hair on fire, Cardiff Crown Court was told.
Paxton, of Cardiff, pleaded guilty to assault causing actual bodily harm.
The court heard sous chef Paxton, who is originally from Kilgetty in Pembrokeshire, carried out the drunken stunt after creeping into Mr Gammer's bedroom and lighting his hair following a night out.
After his victim woke up and ran shouting into the kitchen, Paxton punched him in the face during a row.
He tried to go back to bed - but Paxton returned minutes later to send another jet of fire towards his head, setting his hair alight.
Prosecutor John Warren said: "Connor's hair was burnt away on the left side of his head, and suffered burn wounds to his ear and side of his neck.
"He was given burn lotion and told he might need a skin graft to repair his damaged skin."
The court heard the two men knew each other but were not friends.
Aubrey Samson, defending, said Paxton was "disappointed" about his behaviour after moving to Cardiff to start work at the Pilot restaurant in Penarth.
The court heard he wanted to make a fresh start as a chef having 24 convictions back in his home town of Kilgetty in Pembrokeshire.
Sentencing him on Tuesday, Judge Thomas Crowther told Paxton: "You used a flamethrower on a man who was fast asleep.
"The public would be horrified if I didn't give you an immediate prison sentence."
A chef has been jailed for 12 months for setting a sleeping man's head on fire with a homemade "flamethrower", causing him severe burns.