Seeking to expand its already well-honed ability to sell targeted Internet advertisements, online search leader Google Inc. (GOOG) said it has agreed to pay $3.1 billion in cash to acquire ad-management technology company DoubleClick Inc.

The two companies announced the deal after the markets closed Friday. The boards of both companies have approved the takeover, which is expected to close by the end of the year.

New York-based DoubleClick helps its customers place and track online advertising, including search ads, which Google — more than its nearest search competitors Yahoo Inc.(YHOO) and Microsoft Corp. (MSFT) — has turned into an extremely lucrative business.

Shares of Mountain View-based Google rose 3 cents to $466.32 in after-hours trading. DoubleClick has been privately held since 2005.

The sellers are San Francisco-based private equity firm Hellman & Friedman, along with JMI Equity and DoubleClick management.