The Giants and Tim Lincecum have agreed to a two-year, $40.5MM contract extension, avoiding arbitration with the two-time Cy Young Award winner. The contract became official once Lincecum passed his physical with the team.

The two-year deal buys out Lincecum's final two seasons of arbitration eligibility and avoids a potentially historic hearing. The right-hander will earn $18MM in 2012 and $22MM in 2013 to go along with a $500K signing bonus. The deal includes a limited no-trade clause that allows Lincecum to select a certain number of teams to which he can block a trade. Both sides remain open to discussing a longer term contract in the near future.

Lincecum, a Beverly Hills Sports Council client, filed for a $21.5MM salary through arbitration and the Giants countered at $17MM, as MLBTR's Arbitration Tracker shows. Both figures set new records for players with less than six years of service time. Derek Jeter ($18.5MM) and the Yankees ($14.25MM) had established the previous marks more than a decade ago, in 2001.

Lincecum, 27, has a 2.98 ERA with 9.9 K/9, 3.3 BB/9 and a 47.1% ground ball rate in 1028 career innings. He already has two Cy Young Awards and four All-Star Game selections to his name. Only four pitchers – Roy Halladay, C.C. Sabathia, Justin Verlander and Dan Haren – have produced more wins above replacement since 2007, Lincecum's rookie season.

Henry Schulman of the San Francisco Chronicle was the first to report that an agreement had been reached, with Jon Heyman of CBSSports.com reporting earlier on Tuesday that the sides were "very, very close" to a two-year deal worth a little more than $40MM. Schulman, his Chronicle colleague John Shea and Andrew Baggarly of the San Jose Mercury News all added contract details (all links are via Twitter).