It wasn’t the cleanest game of Roy Williams’ career, but it was a milestone victory all the same.

Brandon Robinson scored a career-high 20 points and Williams tied his mentor on the all-time wins list as North Carolina beat Yale 70-67 on Monday night.

Justin Pierce added 14 points for the Tar Heels (8-5), who nearly squandered a 12-point lead with six minutes remaining.

Williams picked up his 879th career victory as a head coach, tying Dean Smith for the fourth most in Division I men’s basketball history. Williams worked as an assistant for Smith at North Carolina for 10 seasons from 1978-88.

“It’s a number,” Williams said. “It means I stayed around a long time, probably longer than some people wanted me to stay at places.”

Garrison Brooks had 11 points and 11 rebounds for the Tar Heels, and Jeremiah Francis had 10 points.

Azar Swain’s 30-foot 3-point attempt misfired at the buzzer for Yale (10-4).

“It’s not too often that’s Carolina is going to lose a nonconference game in this building,” Yale coach James Jones said. “It just doesn’t happen very often. And we were as close as you can possibly be.”

Swain battled through a sore ankle to score 21 points for Yale, whose seven-game winning streak ended. Jordan Bruner had 17 points and 15 rebounds, and Paul Atkinson added 10 points.

North Carolina answered a 7-0 run by Yale to open the second half with a 20-4 spurt, taking a 52-39 lead with 9:27 remaining.

BIG PICTURE

Yale: Fresh off a 54-45 win at Clemson on Dec. 22, the Bulldogs missed their opportunity for a second consecutive road win against an Atlantic Coast Conference foe. But their prospects remain promising. Yale has experience (six upperclassmen in its top seven, including all five starters) and plays stingy defense, a combination that could help the team repeat as Ivy League champion and return to the NCAA Tournament for the second year in a row.

North Carolina: Freshman point guard Cole Anthony, the team’s leading scorer, is scheduled to miss 2-4 more weeks in his recovery from an arthroscopic procedure on his right knee. Without him, the Tar Heels are ordinary at best. But their schedule over the next month is manageable, giving them a chance to stay in postseason contention as Anthony works his way back.

POSTGAME CEREMONY

The school honored Williams on the court immediately after the game, with Robinson and Brooks joining Smith’s son Scott in presenting Williams a framed piece picture of Smith and Williams together. Williams became emotional as he discussed the milestone in his postgame press conference.

“Scott Smith came out and said one thing, and I think he’s right,” Williams said. “He said, ‘Dad would have been really happy.’ And I think he would be.”

INJURY UPDATE

North Carolina freshman guard Anthony Harris went down with just more than three minutes to play after his right knee buckled. Harris missed the team’s first eight games of the season while recovering from a torn ACL in his left knee. “Our hopes and prayers are that there’s nothing seriously wrong, but we won’t know until they do all the tests and things like that,” Williams said. “My team is hurting for him right now.”

WILD FINISH

The Tar Heels gave up a 3-pointer and a conventional three-point play, fouled a 3-point shooter, and missed the front end of a one-and-one in the final 43.7 seconds. “We’re happy that we sneaked by,” Williams said. “We didn’t make the plays we’d like to make down the stretch.”

STAR WATCH

Robinson scored 14 points and made four of his career-high five 3-pointers in the second half. His final 3-pointer gave the Tar Heels a 65-57 lead with 2:07 to play. “I credit my teammates,” Robinson said. “I wasn’t shooting the ball good early, and they were just telling me and staying in my ear to keep shooting.”

UP NEXT

Yale: The Bulldogs play at home for the first time since Dec. 1 when they take on Division III Johnson & Wales on Jan. 12.

North Carolina: The Tar Heels host Georgia Tech, a team they haven’t lost to at home since 2010, on Saturday night.