Originally acquired before the 2011 last season in a trade with Baltimore for third baseman Mark Reynolds, Hernandez has a 3.15 ERA in 141 career relief appearances.
"I love how the organization has treated me since I've been over here," Hernandez said. "I can see myself living here one day past baseball. I'm definitely grateful and hopefully I can be here well after two years."
Last season, the 27-year-old set career highs with 11 saves, 74 games and 77 strikeouts. In 33 games in 2012, Hernandez boasts a 2.90 ERA with 45 strikeouts. On Saturday against the Cubs, he recorded a save and collected his first career hit, the first D-backs pitcher to do both in the same game since Jose Valverde in 2003.
"He's been great for us since he's came over here," D-backs manager Kirk Gibson said. "He's been dominant for us, he's healthy and he's got a golden arm. We believe in him and what he can do in the future."
Hernandez said the negotiations had been on-going since the season began, but picked up steam within the last couple of weeks.
Although 35-year-old J.J. Putz holds the closer role right now, Hernandez hopes he can take over the reins when the time comes.
"I think that's in everybody's mind as a reliever, you just have to wait your turn," Hernandez said. "Having J.J. in front of me, he's helped the mental aspect and being able to prepare."
Tyler Emerick is an associate reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.