The 19-year-old striker has scored two goals in 20 appearances since breaking into the first team at St Mary’s during the second half of the 2013-14 season.
Speaking to MK Dons Player HD he said: “It’s unbelievable to be here. From the moment I got here, I’ve been made to feel really welcome – to feel wanted by someone like Karl (Robinson) and to be at this kind of club gives me a real boost.
“I’ve talked to people about the way this club operates and it gives off a similar feel to where Southampton were at this point. It feels like the club are going in a similar direction and so it was a no brainer to come here.”
MK Dons boss Robinson said: “I think everyone will be excited by Sam. He’s a player who I’ve watched closely for years. He’s a really talented player and it wasn’t something I thought we’d have the opportunity of doing.”
Gallagher returned from a long-term injury lay-off in February and played a big part in helping Martin Hunter’s side win the U21 Premier League Cup.
He made 16 appearances for the U21s last season, scoring a stunning winner in their cup success against Blackburn Rovers at St Mary’s in April.
Gallagher featured against RB Leipzig and Valencia CF this pre-season, but now makes the move to stadium:mk as he looks to make his mark in the Sky Bet Championship.