Judge Charles Rubin banned Michael from Will Rogers State Park, where the singer was arrested last month. He also ordered Michael to undergo psychological counselling.
"The court is concerned he not get into this situation again," Mr Rubin said.
Michael, 34, was arrested on 7 April when an undercover police officer allegedly saw him commit a lewd act alone in a toilet at the park, which is across the street from the Beverly Hills Hotel on Sunset Boulevard.
He acknowledged later that he is gay and said he was embarrassed by the arrest.
He told CNN: "I won't even say it's the first time it's happened."