The former Alloa keeper, who was recently linked with a move to Celtic, has committed himself to the Dens Park club until the summer of 2018.
Bain quit Recreation Park last summer as he was reunited with former Wasps boss Paul Hartley on Tayside.
The 23-year-old had to wait for his opportunity as Kyle Letheren started the campaign in goal for the Dark Blues, but he has cemented his place as first choice at the club since late October.
Bain has notched up five clean sheets in 20 appearances as the Scottish Premiership new boys chase a top-six slot in their first season back in the top flight.
Dundee managing director John Nelms said: “We are very happy to have a young talent like Scott Bain commit his future to us as we continue to build for a long bright future for Dundee Football Club.”