Jurgen Klopp's Liverpool are in pole position ahead of the return at Anfield on Wednesday, August 23.
After goalkeeper Simon Mignolet had saved a first-half penalty, 18-year-old defender Trent Alexander-Arnold curled in a free-kick to give Liverpool the lead.
Ex-England forward Milner made sure of victory in south-west Germany by curling in a cross-cum-shot, which dropped inside the far post on 75 minutes after deflecting off Havard Nordtveit for an own goal.
Hoffenheim pulled a goal back when replacement Mark Uth managed to beat the offside trap to score late on.
Liverpool's want-away attacking midfielder Philippe Coutinho sat out the play-off with a back injury.
The Brazilian is desperate to leave Anfield for Barcelona after handing in a transfer request, but Liverpool insist he is not for sale.
Belgium goalkeeper Mignolet saved an early first-half penalty to deny hosts Hoffenheim an early lead in Sinsheim.
When Liverpool's Dejan Lovren brought down Germany winger Serge Gnabry, Hoffenheim's ex-Leicester City striker Andrej Kramaric stepped up for the spot kick.
The Hoffenheim forward squandered the golden chance, weakly firing his 11th minute spot-kick at Mignolet.
At the other end, Liverpool's Egypt striker Mohamed Salah fired just wide of the post on 15 minutes after sprinting clear and beating Hoffenheim goalkeeper Oliver Baumann.
Alexander-Arnold gave Liverpool the lead when his floated free-kick beat Baumann on 35 minutes.
However, Hoffenheim could have gone into the break level when striker Sandro Wagner hit the post after Mignolet blocked a Gnabry shot.
Liverpool should have made it 2-0 straight after the break when Baumann saved Roberto Firmin's shot from point-blank range after Sadio Mane's clever cross.
Substitute Milner put the matter beyond doubt when he snapped up Firmino's pass to the wing from a quickly taken free-kick.
He fired home off his left boot on 75 minutes as the shot clipped Nordtveit and went into the net.
Uth netted Hoffenheim's consolation goal to give his team a lifeline when he managed to hold off Alexander-Arnold to score on 87 minutes.