Ireland top Pool C ahead of Australia and will face Wales in the last eight, while Italy head home after the defeat.
O'Gara slotted home another three points after 16 minutes but shortly after Bergamasco's boot again brought his side level.
The Italians' discipline was poor and they were caught offside seven minutes before the break as O'Gara gave his side a three-point lead at the interval.
Ireland dominated the second period as O'Gara slotted home another penalty five minutes after the re-start before Brian O'Driscoll touched down under the posts.
Ireland were in full swing and Graham Earls scored in the corner after 52 minutes following good work from Gordon D'arcy.
Sexton replaced O'Gara and added a further three points with 11 minutes left to make the score 29-6, before Earls raced down the right to touch down again, as Sexton converted to seal a comfortable win.