Thomas James Weldon was ordered to refrain from trying to contact the actress or Louis Bardo Bullock, an infant boy the Academy Award-winner is in the process of adopting.
The restraining order also protects the children of Bullock's ex-husband Jesse James. The children occasionally stay with the actress.
Bullock first obtained a restraining order against Weldon in 2003. The order was extended but expired last year because Weldon was being held in a Tennessee mental hospital.
After his release earlier this year, he traveled to Wyoming in an alleged attempt to meet the actress, according to Bullock's attorney Ed McPherson.
Weldon was committed indefinitely to a state mental hospital in Wyoming on Tuesday.
"It's obvious that this fixation on her has not changed despite seven years in the hospital in Tennessee," McPherson said.
Bullock did not attend Friday's hearing.