Police seized nearly £2m of amphetamine and found ingredients to manufacture a further £2.3m when they smashed a Doncaster drugs operation.
More than 40kg was found in the flat in Bessacarr Court and a car outside while liquid sufficient to manufacture another 50kg was recovered.
Officers were already watching last spring but carried out the raid after arrests were made following a heroin deal arranged by two of those involved.
Paul Mitchell, prosecuting, told Leeds Crown Court that Daniel David Dobbs and Paul David Cook were both seen with Patrick Giles on May 2 before a meeting with lorry driver Paul Rankin in Essex.
When Giles was arrested after a chase, a bag containing 9.4kg of heroin was found with a wholesale value of £262,250 and potential street value of £847,000.
The Doncaster address was used to produce amphetamine sulphate paste, mixed with a cutting agent before being sold.
Dobbs, 25 of Scarborough Road, York, who admitted conspiracy to supply amphetamine and was convicted by a jury of conspiracy to supply heroin was jailed for 13 years six months. Cook, 46 of Burton Road, Hornsea who pleaded guilty to both conspiracies was jailed for eight years eight months.
Giles, 26 of Matson Road, Bridlington, who admitted possessing heroin with intent to supply and Rankin, 48 of Cromwell Road, Beccles, Suffolk who admitted conspiracy to supply heroin were each jailed for five years.