Nick Bosa pumps up the crowd as he waves a 49ers flag in the air and plants it on the field, much like Baker Mayfield's Oklahoma flag on Bosa's Ohio State field two years ago. (0:18)

SANTA CLARA, Calif. -- San Francisco 49ers defensive end Nick Bosa has a long memory. So long, in fact, that as he spent most of Monday evening in Cleveland Browns quarterback Baker Mayfield's face, he harkened back to what Mayfield did on Sept. 9, 2017.

That was the night Mayfield planted an Oklahoma flag at midfield of Ohio Stadium. The thought of it has remained etched in Bosa's mind since. Which is why, as the Niners prepared to play the Browns, Bosa planned a sack celebration in which he would mimic Mayfield's celebration if he got the chance.

Sure enough, Bosa dropped Mayfield to force an intentional grounding with 10 seconds left in the first half of San Francisco's 31-3 win at Levi's Stadium. Bosa jumped up, ran a few yards down the sideline nearest the 49ers bench and began waving and then planting an imaginary flag in a way that closely resembled what Mayfield did two years ago.

"I think everybody knows what that was for," said Bosa, an Ohio State product. "I just wanted to get payback. He had it coming."

According to Bosa, the celebration was something he concocted over the 49ers' Week 4 bye in conjunction with Sam Hubbard, another former Buckeye and current Cincinnati Bengals defensive end.

Bosa said he mentioned the possibility of the celebration to Hubbard, who told him that he too had planned to do it if he was able to sack Mayfield this season. Bosa even went so far as to practice the celebration a little bit in his room over the bye so as to do it as accurately as possible.

And if it wasn't clear from the flag-planting that Bosa remembered Mayfield's collegiate celebration, Bosa said he also took part in a little trash talk, something he doesn't normally do.

According to Bosa, he spent much of the night screaming "Ba-ker, Ba-ker" and telling Mayfield to "pick it up, we want a challenge." Bosa said Mayfield didn't respond much.

"I don't know how anybody thought he would be able to see over Arik [Armstead] and Buck [DeForest Buckner]," Bosa said. "But he was panicking. He was double clutching, rolling back and forth. We had him rattled all game."

Mayfield went 8-of-22 for 100 yards with no touchdowns and two interceptions for a passer rating of 13.4. He was pulled in the fourth quarter in favor of Garrett Gilbert.

Two years ago, Mayfield led the Sooners to a 31-16 victory over Bosa and the Buckeyes, which helped propel Oklahoma to the College Football Playoff. After that win, Mayfield took the OU flag to midfield, waved it around, then planted it inside Ohio State's block O logo.

Mayfield said he wasn't aware of Bosa's celebration until just before his postgame media availability. He didn't have much to say when asked about it.

"Good for him," Mayfield said. "Good play."

The hit on Mayfield was one of many good plays for Bosa on a night when he led the charge for San Francisco's dominant defensive performance.

In unofficial press box statistics, Bosa had four tackles, two sacks, two tackles for loss, five quarterback hurries, a forced fumble and a fumble recovery. According to ESPN Stats & Information research, Bosa is the only Niners player in the past 25 years with two sacks, a forced fumble and a fumble recovery in a single game.

San Francisco coach Kyle Shanahan said after the contest he was not surprised by Bosa's early-season impact and also wasn't bothered by the celebration.

"I mean, as long as it wasn't an Ohio State flag or something, I'm cool with that," Shanahan said. "Hopefully, it was a Niner flag and he didn't offend anybody. Hopefully, he enjoyed it."

ESPN's Jake Trotter contributed to this report.