The deal includes $21 million guaranteed, the source said.
McKinney was the Texans' second-round pick in 2015 and has played a major role in the team's defense. The 25-year-old had his best season in 2016, when he had a career-high 129 tackles and five sacks.
"Benardrick [McKinney] plays a key role in our defense and has been highly productive, but more importantly he is a core player who has developed into a team leader within our program," general manager Brian Gaine said. "We are excited to have him a part of our long-term future here at the Texans."
Earlier this offseason, Gaine praised McKinney's leadership and production, while noting he plays a core position. The Texans expect McKinney to have an even bigger role in 2018 after they cut veteran linebacker Brian Cushing in February.
"If you're playing the Mike linebacker role, you're commanding the huddle, you're leading the huddle," Gaine said. "Production matters, but also the fact that we feel like he's built to last. We feel that he meets the height, weight, speed parameters that we want in the role, but he is now the guy that leads the huddle. That's a big hole to fill now with Brian Cushing gone. So, we are expecting big things from a leadership standpoint and perhaps now he's ready to do that."
Before signing McKinney, the Texans had more than $35 million in cap space. Gaine has also expressed optimism that Houston will be able to sign 2014 No. 1 pick Jadeveon Clowney to a long-term deal before the season starts.