Kiwi driver Brendon Hartley has signed off from this year's World Endurance Championship campaign for Porsche with a respectable second-place finish in Sunday's Six Hours of Bahrain event (NZT).

Hartley, alongside teammates Earl Bamber and Timo Bernhard, finished a lap behind Toyota-driving winners Anthony Davidson, Kazuki Nakajima and Sebastien Buemi.

It was the latter trio's fifth win of the campaign, but still not enough to topple Hartley and his teammates at the top of the WEC leaderboard.

Hartley, Bamber and Bernhard wrapped up the Championship title two weeks ago by finishing third in the Six Hours of Shanghai event.

It's Hartley's second endurance title in three years and caps off an extraordinary second half of 2017 for the Manawatu 27-year-old.

He has juggled his Porsche WEC duties with a Formula One stint at Toro Rosso, and has signed a full-time contract to drive for the Red Bull feeder team next year.

However it is unclear if he'll return to endurance racing in 2018, with Porsche set to end their Le Mans Prototype One (LMP1) programme after this year.

Hartley has already started three times for Toro Rosso in 2017 - becoming the first New Zealander to race in F1 since 1984 - but dropped out of two races with engine problems and finished 13th in the other.

Toro Rosso will switch from Renault to Honda engines in 2018, but only after Hartley rounds out the F1 season at next week's Abu Dhabi Grand Prix.