Ducati have chosen Andrea Dovizioso to ride alongside Jorge Lorenzo ahead of Andrea Iannone for the 2017 and 2018 MotoGP seasons.
Defending champion Lorenzo will move to Ducati for the start of next season after his move from Movistar Yamaha was announced last month.
Dovizioso and current team-mate Iannone have struggled for Ducati this season, with each rider failing to finish in three of five races in 2016.
Yet, despite retiring in three successive races, it is Dovizioso who has been given the nod to stay for the next two campaigns after reaching an agreement with Ducati.
"I am very satisfied to have reached this agreement with Ducati and to be able to continue the adventure begun back with them in 2013," Dovizioso told Ducati's website.
"In the last few years we have worked with a lot of commitment and we have succeeded in taking the Desmosedici GP to an excellent competitive level, and so I am convinced that soon we will obtain the satisfaction that we deserve."
Meanwhile, Iannone said: "Obviously I am sorry that my time with Ducati will draw to a close at the end of this season, but I am grateful to the Bologna manufacturer for the opportunity it has given me in the last few years.
"I made my MotoGP debut with Ducati and I have grown up with them, always succeeding in improving my level of performance.
"In the remaining races I will give my all, as I always do, because I am convinced that thanks to the competitiveness of the Desmosedici GP we can achieve some great results."