BOSTON -- Paul Pierce stepped to the line, moved into NBA history and then finished off the Milwaukee Bucks. It was a moment he never would have dreamed of a few years ago.

Pierce scored 12 of his 28 points in overtime to reach 20,000 points in his career, added a key steal with 27 seconds left and helped the Boston Celtics beat the Bucks 105-102 on Wednesday night.

With the Celtics clinging to a 97-95 lead late in OT, Pierce hit the first of his two free throws, joining Hall of Famers John Havlicek and Larry Bird as the only players to reach the mark while playing their entire careers with Boston. He didn't stop there, hitting five more to seal the win.

"That was an emotional moment for me. It was tough for me to swallow at that point," he said. "You don't see that often that a player accomplishes the feat with one team. Five years ago, I would never have imagined I would score 20,000 points in a Celtics jersey. I was a disgruntled player."

Ray Allen had 23 points for the Celtics (4-1), Rajon Rondo had 17 points and 15 assists and Kevin Garnett scored 13 and grabbed eight rebounds.

Andrew Bogut led the Bucks (1-4) with 21 points and 13 boards. Ersan Ilyasova and Carlos Delfino each scored 15 points and Brandon Jennings had 13.

"Hopefully this is a test for us and see how we need to play every night," Jennings said of the Bucks' slow start. "We did a lot of good things tonight. Somebody's got to lose."

Boston had a six-point lead with 1:20 to play in regulation, but the Bucks rallied to tie it on Delfino's driving basket with 10.5 seconds left.

"We fought, got into overtime and had our chances," Milwaukee coach Scott Skiles said. "We just weren't able to get it."

In overtime, Jermaine O'Neal tipped in Allen's miss, giving Boston a 97-95 edge with 1:49 to play. Pierce then nailed two free throws 30 seconds later.

Bogut scored on a drive and was fouled on the play but missed the free throw, leaving the Bucks behind by two. After missing a jumper, Pierce picked off a pass in front of Boston's bench.

Pierce then hit two free throws with 13.3 seconds left to reach the 20,000-point mark. He added four more in the closing 10.3 seconds.

"I knew I needed to score 23 tonight to get it," he said. "You ask any player and they know it. If you need another assist for a triple-double, they know it."

Boston center Shaquille O'Neal missed his second straight game after bruising his right knee last Friday in a home win over the New York Knicks. Boston coach Doc Rivers said before the game he didn't think O'Neal would be able to play the team's next game Friday against former Celtics assistant Tom Thibodeau, who left to coach the Chicago Bulls after last season.

Rondo, who averaged 16.8 assists in the first four games, had just one in the opening 18½ minutes.

Trailing 82-77 after Jennings scored on a drive, the Celtics went on a 13-2 run over a 1:38 stretch late in regulation.

Garnett started it with a dunk over Bogut. He was fouled on the play and made the free throw. The two had a brief shoving match and were whistled for technicals.

Milwaukee later closed to 90-89 on Jennings' breakaway layup. Allen hit just one free throw, setting the stage for Delfino's basket. Rondo missed a jumper as time expired, sending it to OT.

That's when Pierce took over.

"It is a very small window of people that are in it," Garnett said of Pierce joining him as one of 36 players in NBA history with 20,000 points. "It is a good list of people to be neighbored by, so congratulations Paul."

Jermaine O'Neal, who joined the club this offseason, always felt Pierce deserved his place among the game's greats.

"Even before I got here, I thought that he's one of the best players in the league for a long time," he said.

Allen scored 15 points in the first half, which ended with the teams tied at 47. Both then clamped down defensively in the third quarter.

After the Bucks scored the first six points -- four by Bogut -- in the third, Boston came back with consecutive baskets by Garnett and Jermaine O'Neal. After that, neither team held more than a four-point edge the rest of the quarter.

Milwaukee led 63-62 entering the final 12 minutes.

Game notes

Milwaukee's Keyon Dooling played his 600th career game. ... Jermaine O'Neal started at center for Boston. ... The teams split four meetings last season. ... Corey Maggette, acquired in an offseason trade with the Golden State Warriors, entered the game tied for the team scoring lead with 16.0 points per game coming off the bench. ... Bogut played only two of the four last season but averaged 25.0 points and 15.5 rebounds.