Brown was in court for a probation violation hearing related to a 2009 assault involving his then-girlfriend Rihanna.
Prosecutor Mary Murray had filed a motion asking the judge to remand the R&B singer, saying "he continued to pose an increasingly violent danger to society."
Brown was expelled from a treatment program in November for an outburst, two weeks after his arrest in Washington D.C. in October for allegedly breaking the nose of one of his fans. Murray says that arrest could be a violation of his probation and she believes evidence from that case can be presented.
But Judge James R. Brandlin agreed with Brown's attorney, Mark Geragos, that no new facts have come to light in that case and that the singer is making significant progress in rehab.
"We feel he's making tremendous strides. The judge quoted the probation report, saying he's made great strides," said Geragos. "He's got a great attitude. Anyone who saw him in court today would recognize how good he looks...There's no reason to put him into custody at this point. We're happy that the judge agreed with us."
Brown has tested negative for narcotics four times when tested by the probation officer and all times when tested at the rehab facility.
Brandlin agreed with the probation officer's recommendation to maintain the singer in the rehab program. The judge also ordered Brown to take his medication as directed and to continue to fulfill his community service hours.
Brown is due back in court for a probation violation hearing on Feb. 28.