The Republic of Ireland international’s previous deal was due to expire this summer but manager Ralph Hasenhuttl has moved swiftly to secure the future of one of the most experienced members of his squad.
Long, who joined the Saints from Hull City in August 2014, has made 19 Premier League appearances for Southampton this season, scoring two goals.
The 33-year-old scored the fastest goal in Premier League history when he found the back of the net after just seven seconds against Watford last season.
Hasenhuttl, who also signed a new four-year contract earlier this week, said: 'Shane is an outstanding professional. He has been an important player for me and I know also for the managers before me.
'He has scored some big goals for us and helped to create many more for his teammates too. I think that is one of his top qualities. He is a great team player, and someone who has a positive impact on the group as a whole when he plays.
'He is also a player who sets the right example for our youngsters to follow in how he conducts himself on and off the pitch, so this is good news for us that we will have him as part of the squad for another two years.'
Long added: 'I love the way the club is run, I love what the club stands for and I'm excited about what the club will do over the next couple of years.
'I can see the club pushing up the league, back to where we all want to be, and I want to be part of that. I'm just delighted to get it done.'