York Crown Court heard Joshua Townsend and Callum Shields, both aged 19, targeted a house in Scarborough on April 26.
The victim was in bed just after 11pm when he was woken by loud banging on his door and saw one man in his lounge and one near the door.
The two men became aggressive towards him, threatening him with a hammer and demanding he hand over money.
The pair stole the victim’s car keys and drove away in his car that was parked outside.
Police spotted the stolen car on the A171 towards Whitby before it came to a stop on the road to Harwood Dale.
Police found Townsend in the passenger seat and Shields in the driver’s seat.
Townsend had driven the car before crashing, causing minor damage.
Both men pleaded guilty to robbery and aggravated vehicle taking.
Townsend, of Norwood Place, Scarborough was sentenced to six years’ detention in a young offender institution.
Shields of Weaponess Valley Road, was sentenced to five years’ detention in a young offender institution.
Detective Constable Vicky Millington of Scarborough Police, said after the sentencing hearing: “Fortunately they pleaded guilty at the earliest opportunity which prevented the victim going through the ordeal of court and reliving the trauma."