Foster, who was already under contract for 2019, joined Tigers initially on trial last season.
He signed a permanent deal 12 months ago and scored two tries in 19 games - including Tigers’ only touchdown in the Grand Final loss to Leeds - last year.
The 24-year-old has crossed five times in 15 Betfred Super League appearances this term and said he is “made-up” with the new deal.
“It has taken a little bit of time to get it all sorted as we were discussing the number of years that the contract was going to be, but I’m pleased to have penned a new three and a half year deal,” said Foster, who was the first player produced by the Wetherby Bulldogs community club to feature in Super League.
“The decision was never in any doubt, I’ve got nothing but absolute gratitude for the club for what they have done for my career. This is the perfect place for me to be right now.”
Foster made his Super League debut for Rhinos in 2013 before moving on loan to London Broncos.
He spent 2015 on loan at Featherstone before moving permanently to London for the 2016 season.
He was due to join Bradford Bulls last year, but was left without a club when the Odsal outfit went bust.
Tigers gave him a lifeline and coach Daryl Powell said he is “absolutely delighted” the player is staying on a long-term basis.
“Since he arrived at the Tigers his attitude has been outstanding,” said Powell.
“He is one of the first names on my team sheet due to his work rate, toughness and defensive ability.
“Alongside this his versatility to play front-row, back-row and centre is very rare. He has been a great acquisition for us and I’m confident he will continue to get better over the period of his contract.”
Tigers’ director of rugby Jon Wells added: “I am particularly pleased to be talking about what is a key contract signing for the Tigers and for Alex.
“He has been nothing short of sensational for us this season and his development from a fringe member of our squad to a nailed-on starting player over the course of the last two seasons is testament to Alex’s qualities as a person as much as a rugby player.
“We feel he will only continue to improve in our system and we look forward to what the next three and a half years brings.
“I would like to make particular note of the way that Alex and his agent, Craig Harrison, have conducted themselves throughout the negotiations and all parties agree that this is a significant statement by the club and the player in what could yet prove to be Castleford’s best season to date.”