James McCairn, 18, sold crystal MDMA to Cerys Reeve after advertising his illegal trade on Snapchat.
The 14-year-old died after then taking the drug during a sleepover at a friend's house in Greenock, Renfrewshire, on July 13 2020.
First offender McCairn was found guilty of culpable homicide following a trial at the High Court in Glasgow which reduced members of the jury to tears.
Prosecutors said he had "recklessly and unlawfully" given the deadly class A drug to Cerys at his home in Greenock.
McCairn was further found guilty of supplying Ecstasy to other young people in the town between November 2019 and July 2020.
Judge John McCormick told him: "The charge is serious in itself as you supplied class A drugs to school age children.
"The court is determined to do what it can to deter those who are minded to supply drugs to young people.
"You recklessly supplied drugs to Cerys Reeve and as a consequence of ingesting that she lost her life when she was 14 and you were 16.
"I can only imagine the anguish felt by her family and no sentence can reflect on the gravity of what happened.
"Such as the nature of what happened, even members of the jury were reduced to tears when returning their verdict."
The trial heard McCairn had been advertising pills for sale on the morning of July 13 2020.
He had put a message at one stage stating: "Mandy (slang name for MDMA) for sale. Good prices. Get SnapChattin".
He was in contact with Cerys at 2.52am.
The keen dancer had been at a friend's house before going to McCairn's to purchase MDMA.
Cerys returned and stated she had paid £10 for the drugs and mixed the powder into a cup of juice before taking it.
Her friend then came back into the room after making a toastie - and described Cerys soon "acting really weird".
This initially included her not being able to control her arms and kicking items off a window ledge.
The witness went onto describe Cerys grunting, sweating and falling off the bed, which awoke the girl's mum.
Cerys then started burning up and suffered a seizure before she was rushed to Inverclyde Royal Hospital and placed on a ventilator. She was pronounced dead hours later.
The cause of death was "MDMA toxicity" and McCairn continued to advertise drugs for sale an hour after Cerys had passed away.
He suddenly stopped after news of the tragedy spread and other teenagers later told detectives that they had been given MDMA by McCairn in 2020
McCairn did not give evidence during the trial.
Gary Allan QC, defending, told the sentencing hearing: "It's important for me to say in meetings I have had with Mr McCairn it's been plain to me that the utter tragedy of the death of Cerys Reeve as a consequence of ingesting drugs is fully acknowledged by him."