A judge has told "Pharma Bro" Martin Shkreli to keep his mouth shut at his securities fraud trial.

Prosecutors had sought a gag order after an impromptu gaggle by Shkreli last week with news reporters covering his case.

U.S. District Court Judge Kiyo Matsumoto got assurances on Wednesday from the lawyer of the former pharmaceutical company CEO that his client wouldn't talk to reporters anymore in or around the courthouse to avoid tainting the jury. She stopped short of halting his running commentary on social media.

Shkreli became notorious in 2015 when a drug company he founded increased the price of a life-saving drug from $13.50 to $750 per pill. He was arrested on unrelated charges he cheated investors in a pair of failed hedge funds. He has pleaded not guilty. ​