Miles hasn't coached since being fired by LSU in September 2016. He will replace David Beaty.
"I am humbled by the opportunity to lead the KU football program and I am grateful to Chancellor [Douglas A.] Girod and [athletic director] Jeff Long for the opportunity," Miles said in a statement. "We will bring Jayhawk Football back and we will do it with outstanding coaches, tremendous student-athletes of character and ability and an unrelenting drive for excellence. My family and I cannot wait to be a part of the KU family!"
Miles will be reunited with Kansas athletic director Jeff Long after the two worked together at Michigan in the late 1980s and early 1990s. Long reportedly also tried to hire Miles in 2012 when he was the athletic director at Arkansas.
The 65-year-old Miles owns a 141-55 mark in 15-plus seasons at LSU and Oklahoma State.
"Since the beginning of our search, we focused on identifying and recruiting an experienced head coach with a strong track record of success on and off the field," Long said in a statement.
"Les Miles is exactly what we need for our program right now. His national reputation as a great recruiter and as a coach who student-athletes love playing for will enable us to break the cycle and return a winning tradition to the Kansas Jayhawks. We are thrilled to have Les and his family as Jayhawks."
Beaty, who agreed to finish out the season, has posted a 6-31 record with the Jayhawks, who fell to 3-8 this season after dropping a 55-40 decision to Oklahoma on Saturday.
Speculation that Miles was headed to Kansas heated up last Thursday, when LSU announced it had reached a settlement with Miles on a hefty buyout. Instead of paying Miles the $6.5 million it owed him over the next several years, the Tigers instead cut a $1.5 million check to wrap up their financial obligations.
Beaty's final game as head coach of the Jayhawks will be Friday at home against Texas, with the Longhorns needing a win to clinch a spot in the Big 12 championship game.