Earlier this year, Direct Line rejected two takeover bids from the Belgian insurer Ageas where the second offer valued the firm at £3.2bn, which Direct Line branded as "unattractive" offer for shareholders.
Aviva has agreed to pay £3.7bn for rival company (€4.5bn) in time for the Christmas Day deadline.
The deal will pave the way for the combined group to own a fifth of the UK motor insurance market.
A £3.3bn (€4bn) offer for the smaller firm was rejected in November.
Aviva's chief executive Amanda Blanc has welcomed this latest deal as "excellent news".
"Aviva and Direct Line share a deep commitment to excellence in looking after customers and this will remain a top priority following the acquisition," she said.
"The financial strength and scale of the combined group means customers will benefit from competitive pricing, an enhanced claims experience and even better service."
The merger is due to be completed in the middle of next year, after shareholders vote on the deal in March.
It is believed that the deal may draw scrutiny from the UK's competition regulator as the combined group will own such a large share of the UK insurance motor market.