Kahne, 37, has 18 career victories and 173 top-10s in 495 starts. He is finishing a six-year run at Hendrick this season, having won the Brickyard 400 and sitting 15th in the standings.
The Brickyard victory snapped a 102-race winless streak for Kahne, who had a year left on his contract.
"I want to thank Leavine Family Racing for this opportunity and will work as hard as possible to help them continue improving," Kahne said in a news release. "I am ready for this challenge and look forward to making a fresh start."
HMS team owner Rick Hendrick would be responsible for a buyout, so he said in August he would try to find Kahne a ride for 2018. But Leavine Family Racing confirmed Tuesday that it will remain aligned with Richard Childress Racing.
"We look at this as an opportunity to go to the next level," team owner Bob Leavine said in the news release. "This deals partially with performance, because obviously, Kasey is a playoff-caliber driver. He has a wealth of information being with a larger organization like Hendrick Motorsports, and we think that will help us.
"We also look at this as an opportunity for marketing to be able to sell sponsorship. Overall, we think Kasey is a good fit and felt we needed a change."
McDowell is 25th in the standings. After two top-20 finishes in the first 10 races, he has finished top 20 in 11 of the last 18 events.
"He's a close personal friend and he's done a phenomenal job for us this year, but ... we have to look at what's best for our program, and figure out who fits, what fits, who we've got sponsorship for and go from there," Leavine said Friday at Chicagoland Speedway.
"Michael has far exceeded my expectations. It's nothing that he's done."
The Leavine organization was 30th in the team (owner) standings last year and improved to 26th this year.
"What may help our small team more will be the sponsor side and selling a playoff driver," Leavine said Friday. "That's not a knock against Michael, and he knows that, but reality is reality -- [Kahne] is a playoff driver."
Kahne told ESPN.com on Tuesday that he considered racing sprint cars (he owns a World of Outlaws team) and potentially other open-wheel series, but what he saw at LFR and what he heard from Leavine convinced him this was his best opportunity.
"That was something I thought a lot about, but working with Bob Leavine, it just turned out to be more than I expected it to be and got me excited," Kahne said. "At first, I was thinking I probably was going to do a wild season and just do anything and everything.
"Bob changed my mind with what he has, what he wants to make of it and build. I just think [of] where they're at, how they've improved each year. And he's a guy who you can take his word on what he wants to do."
Still in the playoffs, Kahne said he did not expect to join the Leavine team later this year, even if he is eliminated from title contention.
"I really want to finish in the [No.] 5 [Hendrick car]," Kahne said. "I feel like my team guys have done a lot for me. We've worked a lot together and we want to push hard all the way to the end. ... I want to finish what I started with the 5 and just finish on the best note we possibly can, and then move on to a fresh start from there."
Kahne has a new crew chief for the final nine Cup races at Hendrick, which released Keith Rodden from his duties Monday and replaced him with Darian Grubb, a championship-winning crew chief who is a Hendrick competition director.
"I'm not exactly sure what their plan was or how they went about all that," Kahne said about the crew-chief change. "I really don't know. Darian texted me late yesterday afternoon and we began our process for Loudon [this week] and then from there on out. That's all I really know."