A New York City doctor was sentenced Tuesday to seven years in prison for illegally peddling more than a million pills — including powerful prescription narcotics that led to the overdose deaths of three patients, authorities said.

Dr. Lawrence Choy, 66, took a plea deal June 18 in Manhattan Supreme Court and copped to 34 counts of manslaughter, reckless endangerment and the criminal sale of a controlled substance for running a pill mill out of his now-shuttered pain clinic.

“While today’s sentencing cannot erase the harm caused by Lawrence Choy, it may bring closure to families who lost loved ones and hope to patients who looked to him for treatment, and instead developed addiction,” said the city’s Special Narcotics Prosecutor Bridget G. Brennan, whose office prosecuted the case.

Authorities said that the kidney doctor prescribed opioids and other addictive narcotics in lethal doses and combinations. Between 2012 and 2017, Choy’s total of illegally prescribed pills reached roughly a million, according to the Special Narcotics Prosecutor.

At the peak of his practice, over a hundred patients a week crowded his offices at 142-20 Franklin Ave. in Flushing, Queens.

Father of two Eliot Castillo, 35, and Michael Ries, 30, both fatally overdosed within 72 hours of picking up their meds, officials said.

Castillo was discovered dead February 23, 2013, on his mother’s couch from a lethal mixture of oxycodone and alprazolam, for which Choy often provided early refills.

Ries was found dead at his family’s home in Hauppauge, New York, from the deadly combination of oxycodone, alprazolam and carisoprodol.

Ries had sought treatment for anxiety, and Choy ultimately wrote him prescriptions for 24 pills a day, which was more than triple the maximum recommended amount, according to Centers for Disease Control and Prevention guidelines.

The nephrologist was convicted of reckless endangerment in connection to the Jan. 15, 2016, overdose death of chef Daniel Barry, 43, in Suffolk County.

The Attorney General’s office in Pennsylvania kicked off the investigation after noticing a surge of painkiller prescriptions coming into their state from Choy’s office.