Kemeel Reid, 24, hid a Bulldog revolver loaded with three 0.32 calibre bullets in the loft of his home in Finchley Road, Oscott.
Acting on intelligence about him and conspirator T’reece Ellis-Brade, 20, National Crime Agency firearms officers raided Reid’s home on December 15 last year.
Officers also found £3,800 in cash, 100g of cannabis and a 9mm blank ammunition casing.
Reid’s revolver contained his DNA and that of accomplice and friend Ellis-Brade, whom NCA officers arrested at the same time near his home on Malvern Hill Road, near Tyseley.
He fled on foot and discarded two mobile phones and a bag containing 12.5g cannabis and 0.5g cocaine, but he was caught after a short chase.
A search of his home unearthed 52.3 grams of crack cocaine and a 9mm bullet.
Ellis-Brade admitted possessing the revolver, possessing ammunition, possession with intent to supply crack cocaine and possession of cannabis with intent to supply.
He was sentenced on Friday at Birmingham Crown Court to seven years in jail.
Reid admitted possessing the revolver, bullets and cannabis and forfeited the £3,800 cash seized. He was sentenced to six years and three months.
Derek Evans, NCA operations manager, said: “We have removed a deadly firearm and ammunition from circulation in the West Midlands.
“Guns and drugs go hand-in-hand with offenders using firearms or the threat of them to assert their dominance over other criminals, often with a destructive impact on communities.
“Reid and Ellis-Brade were faced with a solid case and had no option but to admit their guilt.
“The NCA leads the UK’s fight against firearms supply and works with partners at home and abroad to protect the public from the criminals who supply them.”