Under an agreement with prosecutors, Lewis, 25, will be sentenced to four months in federal prison and two months in a halfway house. He also must complete 500 hours of community service.
The judge set a sentencing date of Jan. 26.
"I believe it prest of both sides," U.S. District Judge Orinda Evans said in accepting the plea.
The sentence would start after the NFL regular season ends on Jan. 2 and conclude before the next one starts less than a year from now. It was not immediately clear how the sentence will affect Lewis if the Ravens make a run in the playoffs. The Super Bowl is not until Feb. 6.
Drug conspiracy and attempted cocaine (search) possession charges are expected to be dropped against Lewis under the plea agreement. The conspiracy charge can carry a minimum mandatory 10-year sentence, but as a first-time offender Lewis would have likely faced a shorter sentence under federal guidelines had he been convicted of that. His trial had been set for Nov. 1.
Lewis also may face sanctions by the NFL.
During his court appearance, Lewis simply responded "Yes, your honor," or "No, your honor," to questions from the judge.
He smiled as he chatted with his attorneys before the hearing, but wore a stern look as he left the courtroom.
Outside the courthouse, Lewis spoke to reporters after his court appearance. "I made a mistake four years ago, when I was 20 years old, that I am paying heavily for," Lewis said.
"It's a difficult time for me. My family and friends were hurt more."
Lewis was accused of helping broker a cocaine deal for co-defendant Angelo Jackson, a childhood friend, during conversations with a government informant in Atlanta during the summer of 2000. Charges against Jackson are still pending.
Under Lewis' plea deal, he has agreed to testify truthfully at Jackson's trial, also set for Nov. 1, if called as a witness.
Ed Garland, an attorney for Lewis, asked why his client, who had maintained his innocence, was entering the plea. "Jamal made the decision that he wanted to move on with his life," Garland said.
The FBI has said an informant contacted Lewis on his cell phone on June 23, 2000, to discuss selling cocaine to Lewis and Jackson. The FBI said Lewis and Jackson later met the informant at an Atlanta restaurant. Both conversations were taped.
Jackson and the informant met several times more over the next several weeks, but Lewis was not part of any of those conversations, court papers say.
Authorities said they waited until this past February to indict Lewis to protect their investigation.
Lawyers for Lewis accused the informant of trying to entrap their client in an effort to get out of jail time. They had planned a vigorous defense before striking a deal with prosecutors over the last week.
At the time of the incident, Lewis was a star running back out of Tennessee and the draft's fifth overall pick who had returned home to his middle-class neighborhood in west Atlanta to wait out contract negotiations with the Ravens.
However, it was the time Lewis spent that summer with his friends from the area of Bowen Homes, a public housing project four miles away, that clouded the NFL offensive player of the year's future.
The crime-ridden housing project was at the center of a federal drug investigation that ensnared Lewis.
Former U.S. Attorney William Duffey has said the indictment against Lewis came out of an investigation at Bowen Homes that had been going on for at least four years, led to 30 convictions and helped dismantle a cocaine-trafficking ring.
Bowen Homes residents have said Lewis would sometimes hang out at the housing complex.
Lewis, who gained the second-most rushing yards in NFL history last season with 2,066 yards, grew up in a ranch-style house in the Adamsville section of Atlanta.