Nicole Richie pleaded guilty Friday to driving under the influence of drugs and was sentenced to about four days in jail.

"The Simple Life" starlet, 25, was credited for six hours of time served. She was also fined $2,048, ordered to attend an alcohol education course and hit with three years' probation.

Richie, the daughter of pop singer Lionel Richie, must report to serve her time by Sept. 28.

The tiny star showed up at the L.A. County Superior Court in Glendale, Calif., Friday morning looking chic in oversized black sunglasses and a loose-fitting '60s-style black dress with her rocker beau Joel Madden on her arm. Richie is reportedly pregnant with Madden's baby

Superior Court Commissioner Steven K. Lubell told Richie that if she drove drunk again and killed someone, she could be charged with murder.

"You are very lucky that no one was hurt of killed as the result of this incident," Lubell said. "Someone could have gotten killed or injured. The court does not want anything to happen to you.

"If you continue to drive while under the influence of drugs or alcohol and someone gets killed, you can be charged with murder, not manslaughter.

"I hope that never, ever happens," he said.

He said such a murder charge would come under a specific legal provision because she now has two convictions, the first one in June 2003 when she was convicted for driving under the influence of alcohol. The 2003 conviction made her eligible for a sentence of 90 days to a year in jail.

Richie was subdued and somber as she was lectured about her driving. She stood before the judge and softly answered "guilty" when asked how she pleaded to the charge.

She nodded when asked if she understood terms of the plea agreement worked out between her lawyers and the prosecution.

"You are not to drive with any measurable amount of alcohol or drugs in your system," Lubell told her. "You are not to drive without a driver's license."

Lubell also said Richie must prove that she completed a second-offender drug and alcohol program by Feb. 20, 2008, and that she would go to jail for a year if she violates probation.

The judge said the state Department of Motor Vehicles will decide whether to suspend her license.

Richie was arrested early on Dec. 11, 2006, after witnesses reported seeing her black 2005 Mercedes-Benz sport utility vehicle headed the wrong way on a freeway in Burbank.

The California Highway Patrol said she was found parked in the carpool lane.

She allegedly failed a field sobriety test, and authorities said she told them she had smoked marijuana and taken the prescription painkiller Vicodin, a CHP officer said at the time. No drugs were found on her or in the vehicle.

She initially pleaded not guilty in February to a misdemeanor charge of driving under the influence of drugs or alcohol.

Her on-and-off pal and "Simple Life" co-star Paris Hilton just spent about 23 days behind bars for violating probation in an alcohol-related reckless driving case.

The Associated Press contributed to this report.