Federal prosecutors say 51-year-old Alex Borrero, of New Haven, was also sentenced Tuesday to six years of probation.
Borrero pleaded guilty in May 2018 to possession with intent to distribute, and distribution of, heroin and fentanyl.
Authorities say Borrero was tied to the fentanyl and Xanax overdose death of a 25-year-old man in Wallingford in February 2017, as well as the May 2017 overdose death of a 31-year-old man in Branford.
When he was arrested in October 2017, he was in possession of approximately 30 grams of heroin and $1,900 in cash. He had previously spent time in federal prison on drug convictions.