The trial centered around Andrea Constand, the former director of operations for Temple University's women's basketball team, who claimed she was drugged and sexually assaulted by Cosby in January 2004 at his home near Philadelphia.
The 79-year-old Cosby is charged with three felony counts of aggravated indecent assault.
Bill Cosby, 78, was charged in December a year ago with sexually assaulting a woman at his home in 2004 in the first criminal case against the comedian accused of misconduct by dozens of women.
The mistrial, which Cosby's lawyers had supported, means that prosecutors will need to decide whether to retry Cosby on the charges at a later date.
Allred is not the primary attorney for the alleged victim in the criminal trial, Andrea Constand, but attended throughout the trial and deliberations flanked by other accusers whom she represents. Those pills left her incapacitated, and she said she woke up, unable to move, and found Cosby sexually assaulting her.
The BBC's Aleem Maqbool, inside the courthouse, said Mr Cosby was expressionless when the decision was announced.
A decade later, another district attorney reopened the investigation after his lurid deposition became public, and dozens of women came forward against one of the most beloved stars in all of show business.
She reported the crime to police in 2005 and filed a civil suit against Cosby after prosecutors declined to press charges.
The 12 jurors in the case told the judge that they could not reach a verdict after deliberating for six days.
Cosby and his attorneys have maintained that the two were romantically involved and the encounter was consensual.
The judge declared jurors could talk as long as they wanted, and said he interpreted the panel's questions as evidence it wanted to continue working toward a verdict. Cosby has denied all the allegations. The mistrial, as O'Neill put it, is "neither a vindication or a victory", a fact Cosby's many accusers know all too well.
The Canadian said Cosby gave her three pills and wine before touching her breasts, putting his fingers in her vagina and putting her hand on his erect penis after she sought his advice about moving to Canada and switching careers. The case was settled in March 2006 after months of depositions that would come back to haunt Cosby.
This story has been corrected to show that an associate of Andrew Wyatt, Bill Cosby's spokesman, read Camille Cosby's statement, not Wyatt himself. But he admitted obtaining sedatives with a view to having sex. On the fourth day of deliberations, the jury was deadlocked on the charges and are set to return for a fifth day of deliberation on June 16, Friday. Cosby chose not to testify at trial.
The entertainer's wife of 53 years, Camille, slammed prosecutors for bringing the case to court, calling Steele "heinously and exploitively ambitious" in a statement released after the trial.