Rantanen received a pass from Miro Heiskanen near the goal line, slowly took the puck to the net and won it with a backhand to the glove side.
Jason Robertson had two assists, and Jake Oettinger made 18 saves for the Stars (5-3-1).
Matthew Poitras and James Hagens scored for the Bruins (7-2-1), who had won five straight games and finished 3-0-1 on a four-game road trip. Jeremy Swayman made 22 saves.
Rantanen tied it 2-2 at 13:38 of the third period. Bruins defenseman Charlie McAvoy blocked a Roope Hintz shot in the slot, and the puck deflected to Rantanen in the face-off circle, where he snapped a shot to the near side.
Poitras had given Boston a 1-0 lead at 2:09 of the first period. He scored with a one-timer from the left circle off a cross-ice pass by Frederic Brunet.
Rantanen pulled Dallas even, making it 1-1 at 2:50 of the second period by burying the rebound of Robertson’s poke attempt.
Hagens put the Bruins back in front 2-1 at 7:30. Casey Mittelstadt carried the puck out from behind the net and sent a pass to the crease from the right side before Hagens redirected the puck over Oettinger’s pad.