Lehner, 23, went 12-15-6 with a 3.06 goals-against average and .913 save percentage in 36 games (30 starts) last season. He will be paid $1.5 million this season, $2.025 million next season and $3.15 million in 2016-17.
"We quite honestly spent a long time this summer trying to get a long-term deal done," Lehner told the Senators website. "It turned into a three-year deal which I'm very happy with too.
"I think it's just, from both sides, they wanted me in Ottawa and I've tried to make my point that Ottawa is the place I want to be but, of course, I've got to deserve to be there a long time and that's what my goal is. You never know what the future holds."
He will work alongside Craig Anderson, who has one year remaining on his contract. Anderson played 53 games last season and went 25-16-8 with a 3.00 GAA and .911 save percentage.
"Well everyone wants to play; the guy that says he doesn't will be lying to you," Lehner said. "I think if I can develop more and get better, we have a strong tandem.
"I'm not in a place where I think I should play every game even if it goes really well; I think we have a strong tandem and I think we have a good team going forward. I'll just be happy with competing every day and getting a chance to get a fair battle."
A second-round pick by Ottawa (No. 46) at the 2009 NHL Draft, Lehner is 21-24-10 with a 2.82 GAA, .918 save percentage and two shutouts in 61 games.
"For sure, I think Robin is still developing and we forget he just turned 23 and played as a 22-year-old last season," assistant general manager Pierre Dorion told the website. "He has accomplished a lot in our organization, winning the Calder Cup at 19 years old, being a playoff MVP. Having ups and downs here with our team I think he has shown great maturity, I think the fact he is spending most of the summer here in Ottawa shows he is ready to take on a bigger role. I think just having him signed for the next three years is a really good sign for us."
Dorion added the Senators would like to sign forwards Bobby Ryan and Clarke MacArthur, who each has one year remaining on his contract, to new deals. They each can become an unrestricted free agent next summer.
"We had really productive talks on Clarke MacArthur and Bobby Ryan," Dorion said. "As you guys know these deals don't get done in a day, [Senators GM] Bryan [Murray] had preliminary talks with the agents beforehand and [Wednesday] I'd call it productive talks on both sides of things. I'd like to get these deals done yesterday and I'd like them done July 1 at 12:01 p.m., but they take a little while. They're guys that are both going to be pending UFAs, so you have to make sure it works well for both parties."