The Germany international was one of six City players to retain their place in the starting lineup on the back of the loss to Chelsea at the weekend, with the injury-hit hosts requiring a point heading into the game to hold off Lyon.
Winless Hoffenheim made life difficult for their opponents by taking the lead through in-form striker Andrej Kramaric 16 minutes in, but a sweetly-struck free kick and a well-taken finish from Sane either side of half time got City over the line.
Despite falling behind in four of their six group games, the Citizens finished five points clear of Lyon in the end, while Hoffenheim missed out on a Europa League spot with this defeat.
Needing a victory of their own and a helping hand from Lyon against Shakhtar Donetsk to finish third, Hoffenheim started the brighter of the sides as Joshua Brenet and Florian Grillitsch both fired in shots early on.
Kramaric sent the resulting penalty down the middle to score for a ninth match running, but City could perhaps consider themselves fortunate to still have a full complement of players.
The goal did at least act as a wake-up call for the sluggish hosts, with Gabriel Jesus guiding a header against the inside of the post and Nicolas Otamendi glancing Ilkay Gundogan's free kick against the crossbar.
The German attacker got the perfect blend of dip, power and accuracy on his free kick, sending the ball flying past Baumann 30 yards out from the final meaningful act of the first half.
Baumann recovered from that personal setback by producing a couple of top saves to keep out Laporte early in the second half, though a goal would not have counted had it gone in as the ball had gone out of play in the build-up.
Just when City looked to have wasted their best chance to edge in front, with Bernardo Silva failing to beat Baumann following an over-elaborate move that saw Sterling and then Sane pass up the chance to shoot from a one-on-one position, the key third goal of the match eventually arrived.
Learning from his previous mistake, Sane tucked the ball past Baumann following a quick exchange of passes with Sterling to become the first German player to score a brace against a German club in the Champions League.
A number of shots were fired in by City over the next 15 minutes, including a fierce volley from Phil Foden which Hoffenheim's overworked keeper tipped over the bar.
Foden was making the most of his first European start of the season, popping up on the right to tee up Sterling for the game's final chance, which he could only direct wide of the target.
MANCHESTER CITY (4-3-3): Ederson; Stones (Walker 46'), Laporte, Otamendi, Zinchenko (Delph 64'); Gundogan, Foden, Bernardo (Kompany 85'); Sane, Jesus, Sterling
HOFFENHEIM (3-4-3): Baumann; Adams, Hubner, Kaderabek; Brenet (Nelson 46'), Geiger (Amiri 63'), Grillitsch, Schulz; Kramaric, Bittencourt (Belfodil 70'), Joelinton