Cohen filed the motion Thursday, saying Michael Avenatti's public appearances could undermine his ability to get a fair trial.
U.S. District Judge James Otero of the Central District of California said Cohen "has not demonstrated ... that immediate, irreparable injury would occur in the absence of emergency ... relief."
In the filing Thursday, attorneys for Cohen sought to prevent Avenatti from communicating with news media about Daniels' lawsuit against Cohen and Trump.
"Mr. Avenatti's actions are mainly driven by his seemingly unquenchable thirst for publicity," the filing said. "Mr. Avenatti's publicity tour, wherein he routinely denigrates Mr. Cohen with claims of alleged criminal conduct, is contrary to the California Rules of Professional Conduct, likely to result in Mr. Cohen being deprived of his right to a fair trial, and threatens to turn what should be a solemn Federal Court proceeding into a media circus."
Daniels, whose legal name is Stephanie Clifford, filed a suit against Cohen and Trump for defamation and to void a non-disclosure agreement that bars her from speaking publicly about an affair she says happened with the president years ago.
The adult film star was paid $130,000 by Cohen through a company called Essential Consultants weeks before the 2016 presidential election to keep silent about the allegations. Cohen acknowledged the payment, and Trump has said he reimbursed Cohen through a monthly retainer.
Avenatti called the motion for gag order "a complete joke and baseless" on Twitter Thursday.
"For over 12 yrs, Mr. Cohen and his boss Mr. Trump have routinely tried to "shut people up" and hide the truth through intimidation & threats. Reporters, judges, adversaries, [attorneys.] The motion is right out of their playbook," Avenatti said in a tweet. "And their assault on the 1st Amendment continues."
According to the filing, Avenatti has made 121 television appearances since March 6 to discuss the case and has made 439 tweets relating to the case or to Cohen.