General manager Tom Fitzgerald announced the signing on Tuesday, saying the restricted free agent would be paid $775,000 next season and $875,000 the following year.
Bastian completed his first full NHL season with the Devils, collecting 10 points in 41 games. He led the club in hits (136) and ranked second among all NHL rookies, only two behind Montreal's Alexander Romanov, who played 12 more games.
Bastian was one of 11 New Jersey rookies in 2020-21.
Bastian made his NHL debut on Jan. 19, 2019, and has six goals and seven assists in 48 career games. He was drafted in the second round by New Jersey in 2016. He spent parts of three seasons, 2017-18 to 2019-20, with New Jersey's AHL affiliate in Binghamton, collecting 44 goals and 36 assists in 188 regular-season games.