Court was told the convicted man, who was receiving social aid, sold 97,000 Midazolam pills to Zurich drug addicts between August 2012 and April 2013, the ATS news agency reported.
He rang up sales of 144,000 francs during the period and netted a person gain of 91,000 francs, the court heard.
The defendant acquired the drugs from a now-deceased pharmacist from Zurich-Wiedikon, who allegedly racked up illegal sales in the millions of francs.
He was a repeat offender with a criminal record for similar convictions.
The sentence against him was suspended so the man can attend addiction treatment, ATS said.
He was also ordered to pay the canton of Zurich 65,000 francs in damages.