The company's acquisition of NZX-listed Z Energy is still subject to NZCC clearance, OIO approval and the Z Energy shareholder vote.
Z Energy welcomed the news.
"The sale of Gull is an important step in for the clearance of the Ampol and Z Energy scheme of arrangement," Z Energy said.
The takeover vote will go to Z Energy shareholders at a meeting set for March 25.
The Gull sale follows a competitive trade sale process.
Under its terms, Allegro will acquire 100 per cent of Gull for net cash proceeds of about $509m as well as the assumption by Allegro of $63m of leases and debt-like items.
The transaction is fully funded, with Allegro's financing provided by Ares Capital and ASB.
Under the arrangement, Ampol has committed to a five-year fuel supply agreement with Gull as requested by Allegro, subject to annual price reviews and termination rights.
The acquisition of Gull by Allegro is also subject to approvals by the NZCC and the OIO.
In addition, the transaction will be subject to Ampol successfully completing the acquisition of Z Energy.
Ampol had committed to divest Gull in full to ensure any potential competition law issues were fully addressed as part of its application to the NZCC for approval to acquire Z Energy.
The NZCC's clearance decision is pending.
"If this clearance is obtained, the NZCC will then also need to approve Allegro as the purchaser of Gull and the relevant transaction documents," Ampol said.
Ampol said its plan to buy Z Energy was on track to be completed in the first half of this year.
ASX-listed Ampol intends to use the proceeds of the sale of Gull towards funding the proposed acquisition of Z Energy.
Gull has operated in New Zealand since 1998 and has about 8 per cent market share.
Gull's general manager David Bodger and his management team will be retained by Allegro, Ampol said.
In a separate statement, Bodger said Gull had continued to grow under the ownership of Ampol since mid-2017.
He added Gull had brought competitive fuel prices to New Zealand for the last 24 years.
"We will aim to keep prices low, keep the oil giants honest, and unlike the big guys, we'll just keep things simple including our offices and overheads," he said.
Founded in 2004, Allegro is an independently owned Australian investment manager with A$3.4 billion of assets under management.
Allegro says it has a strong track record of investing in and transforming quality businesses across Australia and New Zealand.
It investments have included Toll Global Express (transportation and logistics), Best & Less Group (retail), Hannahs / Number One Shoes (retail), Perth Radiological Clinic (healthcare) and Great Southern Rail (tourism).