Stokes who has played 63 Tests and 95 ODIs for England completed the marathon near his home and made an appeal to fans to donate towards the foundation.
"Please donate! That was so hard! it's all for a great cause: the NHS Charities Together and Chance to Shine foundation if you can please go and donate," said Stokes in a video posted on Instagram.
"Guys please check my story if you are able to help out and donate towards @NHSCharities and @Chance2Shine ..I've just competed a half marathon to support the 3 guys with their efforts to raise money who did a full marathon in their back gardens," wrote Stokes on Instagram.
The left-handed Stokes on April 8 became the first English cricketer since 2005 to be named as Wisden's Leading Cricketer in the World. In 2005, Andrew Flintoff was named as Wisden's Leading Cricketer of the Year.
The year 2019 proved as an instrumental year for Stokes as he played a key role in England's first 50-over World Cup win and then he went on to play a memorable inning against Australia during the third Ashes at Headingley.
Also, the English all-rounder was named as ICC's cricketer of the year in January 2020.
Ashes 2019: Watch Stokes heroics in Headingley Test