Prosecutors allege that the clinic, Women's Medical Society, at 3801 Lancaster Ave., performed illegal late-term abortions and that Gosnell killed seven infants born viable.
Lerner issued the gag order on his own initiative.
Later, the question of why Pearl Gosnell got a "cell toss" was raised by her newly hired lawyer, Michael Medway.
He said that sometime after April 4, when Lerner reduced the wife's bail from $1 million to $50,000, representatives of the District Attorney's Office, with a subpoena and the approval of prison officials, seized personal letters between the Gosnells.
Medway said that under court rules, the prosecutor may not have contact with a charged individual who is represented by a lawyer without that counsel's approval. Moreover, he said, the prosecutor should have obtained a judge-approved search warrant rather than use a subpoena.
Assistant District Attorney Joanne Pescatore called the practice common in her office: "We had information, and we acted on it. We do this regularly to search cells."
Lerner, however, said he believed the practice had been ruled improper years ago, adding, "I'm at a loss for words."
Tasha Jamerson, spokeswoman for District Attorney Seth Williams, said the office would have no comment on the hearing or Lerner's order.
Later, Deputy District Attorney Edward McCann, who heads the office's criminal division, reiterated that position: "I think it's pretty clear to all of us here that the judge doesn't want us commenting about this case."
Prison spokesman Robert W. Eskind declined to comment on the circumstances of the cell search. Though Pearl Gosnell was allowed to sign her own bail bond April 4, Eskind said, she remains in custody until arrangements are completed for her electronically monitored house arrest.