Zeshaam Khan and Khawaar Awan fired 12 shots through the doors and windows of a house in Pudsey as the couple who lived were inside the property.
Jurors at Leeds Crown Court heard that it was likely that the two men had been hired to kill the man who lived there over a drugs dispute.
The attempted murder took place on June 10, 2018, when the defendants lay in wait for the man in an alleyway at the side of the property on Britannia Gardens with a 9mm pistol and a sawn-off shotgun.
Leeds thunderstorms warning as Met Office shares latest weather forecast
Bloody machete attack on busy Leeds street left man scarred for life
York Road incident: Police appeal after pedestrian killed in crash outside Leeds Dogs Trust
Leeds Bradford Airport: Full statement on August security staff strike
Lamborghini pictured with car on top of its bonnet at busy Leeds junction following crash
Khan and Awan had to climb over a wall before firing the shots which gave the man time to run into his home.
Shots were then fired at head height through the door and kitchen window.
The court heard some of the bullets went through the "full depth" of the house but the couple survived the attack without being injured.
Sentencing the men, Judge Rodney Jameson QC said: "One sensible conclusion is that you were attempting to carry out a contract killing on behalf of someone, or others, and that is the conclusion I have reached."
Khan, 23, of Highlands Close, Bradford, and Awan, 23, of Hollingwood Close, Bradford, also robbed a businessman outside his factory in Bradford on December 9, 2018.
The victim was punched, kicked and struck with an imitation sawn-off shotgun outside Maharaja Textiles, on Cemetery Road,
An employee who was with him was also attacked and knocked unconscious before around £7,000 was taken from the businessman.
The court heard Khan was also paid to shoot at a man on Withins Close, Bradford, on June 25, 2019.
He went to the street with another man who handed Khan a shotgun which he fired twice.
CCTV footage from the area showed children running from the street as the shots were fired.
Khan was also involved in a drug smuggling offence during the period of offending.
Khan was found guilty of attempted murder, two counts of possessing a firearm with intent to endanger life, robbery, possession of an imitation firearm and possessing a firearm with intent to cause fear of violence.
He pleaded guilty to importing a class A drug.
Khan was given an extended prison sentence of 33-and-a-half years.
He must serve a custodial term of 28-and-a-half years, of which two thirds must be spent in prison, followed by a further five years on licence.
Judge Jameson told Khan: "You think of yourself as a gangster and acted as one in a very serious series of offences.
"You are lacking in remorse. You are in my judgement a very dangerous man."
Awan was found guilty of attempted murder, two offences of possessing a firearm with intent to endanger life, robbery and possession of an imitation firearm.
He was given an extended sentence of 24 years.
Awan was told he must serve a custodial term of 21 years followed by a further licence period of three years.