An anonymous bidder agreed at auction to pay $3,456,789 to eat lunch with Warren Buffett, tying the record for the right to dine with one of the world's most admired investors.

The money will go to Glide, a San Francisco charity that provides food, healthcare and other services to people who are homeless, poor or struggling with substance abuse.

The five-day auction on eBay ended Friday night. The winning bid matched the sum paid by an anonymous bidder in 2012, the most expensive single charity item sold on eBay.

Buffett has held 17 annual auctions for Glide, raising about $23.6 million.

The Rev. Cecil Williams, co-founder of Glide and pastor since 1963 of the Glide Memorial United Methodist Church, said Buffett's involvement has attracted more interest in the charity, helping it fund its $17 million annual budget.

Glide provides services including an estimated 750,000 free meals, 815,000 syringes, and day care and after-school programs for 450 children each year.

"This one was really one of the best we've had in my over 50 years," Williams, 86, said after the auction.

The successful bidder and up to seven friends can dine with Buffett at the Smith & Wollensky steakhouse in Manhattan. All topics are fair game apart from where Buffett will invest next.

Buffett, 85, is the world's third-richest person, worth $66.5 billion, Forbes magazine said.

He got rich building Berkshire Hathaway Inc. into a conglomerate with roughly 90 businesses, including insurance, energy, chemical, apparel and food companies, plus a railroad. Buffett is donating virtually all of his wealth to charity.

The auction was created by Buffett's first wife, Susan, and continued after her death in 2004.

According to Glide, the following are the winning bids in the 17 auctions:

2000: Pete Budlong, $25,000

2001: Jim Halperin and Scott Tilson, $20,000

2002: Jim Halperin and Scott Tilson, $25,000

2003: David Einhorn, Greenlight Capital, $250,100

2004: Jason Choo, Singapore, $202,100

2005: Anonymous, $351,100

2006: Yongping Duan, California, $620,100

2007: Mohnish Pabrai, Guy Spier, Harina Kapoor, $650,100

2008: Zhao Danyang, Pure Heart Asset Management, China, $2,110,100

2009: Courtenay Wolfe, Salida Capital, Canada, $1,680,300

2010: Ted Weschler, $2,626,311

2011: Ted Weschler, $2,626,411

2012: Anonymous, $3,456,789

2013: Anonymous, $1,000,100

2014: Andy Chua, Singapore, $2,166,766

2015: Zhu Ye, Dalian Zeus Entertainment Co., China, $2,345,678

2016: Anonymous, $3,456,789