Neighbours on Westfields in Castleford were alerted to the blaze at around 7.40pm on November 25 last year, Leeds Crown Court was told.
Paul Longstaff was seen throwing carpet, wood and car tyres on the blaze as it took hold of the back yard's outhouse, which was connected to the house.
Luckily, the property was empty at the time, but the adjoining homes were occupied.
Prosecutor Jeremy Barton said one neighbour shouted at Longstaff to put the fire out, but he was described as being under the influence of drink, drugs or both and was "oblivious" to what was happening and "looked asleep".
The neighbour even tried to pass him a hose pipe to extinguish the flames but Mr Barton said Longstaff took no notice.
Although the fire had spread to the roof of the outbuilding, the fire service were able to douse the flames before they could spread to the property.
When the police found Longstaff a short time later, he was in possession of a lighter, a bottle of the heroin substitute, methadone, and his face was covered in soot.
The 42-year-old told police he was in the area, but claimed he saw a group of four or five males using a lighter in the back garden of the property.
Longstaff, of Westfield Avenue, Castleford, has 13 previous convictions, but none for arson.
He admitted a charge of committing arson reckless as to whether life endangered.
He also admitted possession of an offensive weapon and a Class C drug after being stopped by police in Castleford town centre in August lat year.
He was found to have a rusty axe down his trousers, and a pill of diazepam.
Mitigating, Mark Foley, said the arson was a direct consequence of him using drink and drugs, addictions he has struggled with since his late teenage years.
He said: "He says he was in a state and had little recollection of what he did.
"He can't provide any explanation whatsoever for what he did. It's quite clear at the time that he was under the influence.
"There's no evidence of being any malice."
Judge Penelope Belcher said that the fire Longstaff started had the potential to spread to the adjoining terraced homes.
She added: "You seemed oblivious to what was happening. You appeared to have no idea what you were doing and had no concern for anybody.
"Fortunately, the fire brigade were able to get this under control.
"There was a serious potential risk to those living in this terrace."
She jailed Longstaff for three years.