Centofonti stayed within striking distance of Lilley for most of the wet and soggy race, and then struck on the final climb with about a half-mile remaining.
"I turned around at the top of the hill, and he was about 20 meters back," Centofonti said. "That's when I got him."
Centofonti cruised from there, winning in 16:23 - just one second off the course record set by Gettysburg's Bryan Beegle in 2005.
"It was my last race on my course," Centofonti said. "I had to go out with a bang."
Lilley finished second in 16:38 and Clear Spring's Ben Courter was third in 17:21.
"It's just those hills," Lilley said. "He knows those hills, and he's real strong on them. On the flat parts, I was breaking him. But on the hills, he reeled me in.
"I'm not really upset that I lost to him because I know he works as hard as I do."
The Smithsburg boys also got all-county (top-seven) performances from David Wilson (fourth, 17:24) and Zach Cross (sixth, 18:10) as they won their first team title since 1993. They beat runner-up Clear Spring, 41-59.
For the Blazers, who had won the previous three county titles, Cory Horton (fifth, 17:51) and Wade Miller (seventh, 18:20) joined Courter on the all-county team.
As expected, Williamsport's Tracey Forsythe ran away with the girls race, winning by 30 seconds in 20:59.
"We told her to take it out fast and win it in the first mile," said Williamsport coach Randy Buchman, whose directions were followed. "We thought if we could get her out into a good, strong lead that she could then just kind of quickly coast on in. Regionals are in only five days. This is a treacherous course, and we didn't want her to get hurt racing someone downhill."
The Smithsburg girls ended the Wildcats' four-year county reign, getting all-county efforts from Chelsea Connelly (second, 21:29), Stephanie Breen (third, 21:56) and Natalie Mancini (sixth, 22:12).
"This was the last time we were all going to run together on this course," said Connelly, a senior. "We were determined."
Brooke Pettner finished fifth in 22:09 to lead runner-up North Hagerstown. Williamsport's Kara Hardy (fourth, 22:00) and Boonsboro's Katie Marshall (seventh, 22:46) were the other all-county runners.
Williamsport hosts the Maryland Class 1A West championships on Thursday.
"Now I'm on Lilley's home course," Centofonti said. "We'll see what happens."