The 21-year-old has risen through the club's youth ranks and made his senior debut against Southampton in 2014.
He has now made 53 league appearances for the League One side, with a single goal against Shrewsbury in April 2016.
Thompson told the club website: "I love it here. I love playing here. It's a great club and a great place to play your football. Long may it continue."
Millwall, who are 10th in League One and five points outside the promotion play-off zone, host 12th-placed Walsall on Wednesday.
Millwall midfielder Ben Thompson has signed a new contract which will keep him at The Den until 2021.