Listen to the Brazilian Grand Prix across BBC Radio 5 live sports extra, the BBC Sport website and mobile app

Fernando Alonso is set to race in the Le Mans 24 Hours for Toyota next season, BBC Sport has learned.

And the McLaren Formula 1 driver's talks with Toyota have extended to the possibility of Alonso doing most of the World Endurance Championship in 2018.

No contract has been formally signed yet but sources say that the Le Mans deal, at least, will happen.

Alonso will drive the Toyota car in a test in Bahrain on 19 November, the day after this season's final WEC race.

"Le Mans is agreed," said a source close to Toyota. "The rest of the season is still being negotiated but it looks like he will do most of the races."

The 36-year-old Spaniard would not confirm his impending deal with the Japanese manufacturer, which would be alongside his full F1 season with McLaren next year.

Alonso said at the Brazilian Grand Prix: "So far, nothing to comment. We will see. Just rumours."

Alonso missed the Monaco Grand Prix to compete at Indianapolis this year

A Toyota spokesman said: "We have no comment to make on this speculation."

The move is the latest development in Alonso's attempt to win the so-called triple crown of motor racing - the Monaco Grand Prix, the Indianapolis 500 and Le Mans, which only 1962 and 1968 F1 world champion Graham Hill has so far achieved.

It has already been announced that Alonso will compete in the Daytona 24 Hours sportscar race in January, as a preparation for a future assault on Le Mans.

Alonso, who won Monaco in 2006 and 2007 and is a two-time F1 world champion, competed at Indy this year and was running competitively when his engine failed in the closing stages of the race.

Doing Le Mans with Toyota is a close-to guarantee that he will have a competitive car and a chance to win - although the car giant has famously never won the demanding sportscar classic.

Toyota's participation in the WEC next season has not been officially confirmed but sources say the company will continue. The team, which is based in Germany, already has a budget for 2018 and is developing its new car.

The championship is going through a difficult time following Porsche's decision to withdraw after this season, which ends in Bahrain on 18 November.

Can we ever really compare the F1 greats?

Toyota would be the only remaining factory team in the championship in 2018.

Neither WEC nor F1 has a confirmed calendar for 2018 but the provisional schedules have only one clash - on 21 October when the US Grand Prix and the Japanese WEC race at Fuji.

So assuming Alonso feels that racing in the WEC alongside F1 would not compromise his performance for McLaren, there is no obvious reason why he could not complete in all the other races.

McLaren racing director Eric Boullier said: "He has said he is keen to do some races outside. There is a case-by-case discussion. His main and first focus is F1, so that has to be the priority. We do everything we can to give him a competitive car and if he has this he will not race anything else.

"I don't think you can physically do two programmes. It would be complicated. Doing Le Mans or Indianapolis or Daytona, why not; it's a one-off. But more than this it is definitely a distraction from his main commitment."