Poppy Widdison collapsed at her home in Grimsby and died in hospital from a cardiac arrest in June 2013.
Her mother Michala Pyke, 38, and her former partner John Rytting, 40, were found guilty of child cruelty, last month.
The pair were also jailed for supplying drugs.
More on this and other North East Lincolnshire stories
Passing sentence, Judge Jeremy Richardson QC said the defendants "existed in a swamp of drug addiction and drug peddling" and Poppy was "plunged into mire of drugs".
"The life of Poppy can only be characterised as tragic from the moment she was conceived," he added.
The jury at Hull Crown Court heard Pyke, of Ladysmith Road, and Rytting, of Frederick Street, encouraged the girl to eat sedatives because they felt she was an inconvenience to their relationship.
Text messages between the pair talked about Poppy having a "blue Smartie" - believed to be a reference to diazepam, and going to sleep, the court heard.
A post-mortem examination could not establish a cause of death, but toxicology tests found she had ingested significant amounts of heroin and methadone for a period of between two and six months before her death.
In a statement, Poppy's father Brendan Widdison said his daughter loved playing with animals and was "everything to us".
"Her bedroom remains untouched just as she left it with all her toys from her birthday that she never got chance to play with," he said.
"I agree that there was failings at different times in Poppy's life but none of this resulted in her death. This was down to two people [and their] despicable acts of unbelievable vileness."
A serious case review into Poppy's death found agencies missed several chances to protect her.
The review found council services did not know the extent to which "she was exposed to risk and harm" daily.
A mother and her ex-partner have been jailed for 13 years each after being convicted of feeding drugs to her four-year-old daughter.