British political parties received a record £40m of donations in the three months before the election, with the Conservatives bringing in more than twice as much as Labour.

More than half of the money was given to the Conservative party, which raised almost £25m between April and June compared with £9.5m for Labour.

The funding received beat the previous record high for a three-month period, which was set during the run-up to the election in 2015, by more than £9m.

The biggest donation to the Conservatives was £1.5m from JCB, the company linked to Anthony Bamford, a Conservative peer and industrialist who also helped fund the Brexit campaign.

Labour’s largest single sum was £1.3m from Unite, the trade union, which donated a total of £4.4m to the party over the three-month period. The party’s funding was heavily dominated by sums from trade unions, with its highest amount from an individual coming from John Baker, who gave £65,000.

Other wealthy businessmen who gave more than £1m each to the Tories included John Armitage, a hedge fund manager, John Gore, a musical theatre impresario, and John Griffin, the founder of the Addison Lee taxi firm.

Michael Ashcroft, the Conservative peer and former party treasurer, contributed £500,000 to the election war chest - his first donation to the party since a gift from his Bearwood company in 2011.

The Liberal Democrats raised about £4.4m, including £300,00 from entrepreneur Andrew Dixon, while the SNP got almost £600,000 of which £500,000 was from lottery winners Colin and Chris Weir.

Ukip managed to raise just £150,000, which is far less than in 2015 when the party’s coffers were boosted by up to £1m from former donor Arron Banks. The Greens raised around £175,000, the Women’s Equality party almost £300,000 and Plaid Cymru just £5,300.

The high sums given in a short period reflect the fact that Theresa May unexpectedly called a snap election, so the parties had less time to build up funds than usual.

The value of outstanding loans also increased by almost £1m to £4,076,803, showing the smaller parties had to resort to borrowed cash to get through the unexpected election period.

Bob Posner, the director of political finance at the Electoral Commission, said: “The snap general election prompted political parties to raise record-breaking sums in the second quarter of 2017.

“The reporting and publication of this data is key to providing voters with transparency about how political parties financed their general election campaigns.”

The result suggests Conservative donors got poor value for money compared with Labour donors. The Tories ended up losing 13 seats overall and adding 5.5% to its vote share, while Labour won an additional 30 seats and added 9.5% to its vote share.