Mr Sunak “pushed” officials to explore an alternative plan that could have helped Greensill Capital - the firm Mr Cameron was lobbying for - according to the two messages.
The chancellor said the former PM “reached out informally by telephone” to him, as well as economic secretary John Glen and financial secretary Jesse Norman, over Covid support for the collapsed finance company.
Greensill, the company Mr Cameron went to work for after leaving government, had approached Treasury officials regarding access to government backed loans through the Covid Corporate Finance Facility (CCFF), administered by the Bank of England.
Mr Sunak said the meetings covered requests made by Greensill to change the terms of the scheme or broaden its scope to allow them access to it, both of which were rejected.
Greensill subsequently filed for insolvency, putting at risk thousands of steelmaking jobs in the UK and rendering Mr Cameron’s reported tens of millions of share options worthless.
The chancellor defended the decision to listen to the requests given the desire to help businesses survive the Covid-19 pandemic, before confirming Mr Cameron’s lobbying activities.
Mr Sunak also published two text messages he sent to Mr Cameron in April 2020, although messages sent by Mr Cameron have been withheld by the government.
The Treasury, responding to a Freedom of Information request, said: “These communications were made by David Cameron in his capacity as an employee of Greensill, and with an expectation of confidence.”
The first message from Mr Sunak to Mr Cameron, sent on April 3, 2020, read: “Hi David, thanks for your message.
“I am stuck back to back on calls but will try you later this evening and if gets too late, first thing tomorrow. Best, Rishi.”
The second message from Mr Sunak sent on April 23 said: “Hi David, apologies for the delay.
“I think the proposals in the end did require a change to the market notice but I have pushed the team to explore an alternative with the Bank that might work.
“No guarantees, but the Bank are currently looking at it and Charles should be in touch. Best, Rishi.”
The Treasury also published messages sent to and from its second permanent secretary, Charles Roxburgh.
Mr Sunak, in a letter sent to shadow chancellor Anneliese Dodds on Thursday, explained Greensill’s requests to change the CCFF.
Listen to the ITV News politics podcast - Calling Peston:
He wrote: “I can confirm that David Cameron reached out informally by telephone to me, and to the economic secretary and the financial secretary, on the matter of Greensill Capital’s access to the CCFF.
“The matter was referred to the relevant officials and, following appropriate consultations as outlined in the previous requests, the request was turned down.
“During this process, this was communicated to Greensill Capital by officials and, in parallel, by me to David Cameron.”
Labour has called on the government to tighten the law on lobbying amid continuing controversy over Mr Cameron’s activities on behalf of Greensill.
The party also believe the texts show Mr Sunak was considering - or potentially pushing other officials into - altering the government scheme to include Greensill.
The former premier has been exonerated by a watchdog.
The Registrar of Consultant Lobbyists concluded Mr Cameron was an employee of Greensill so was not required to declare himself on the register of consultant lobbyists.
Ms Dodds said: “These messages raise very serious questions about whether the Chancellor may have broken the ministerial code.
“They suggest that Greensill Capital got accelerated treatment and access to officials, and that the Chancellor ‘pushed’ officials to consider Greensill’s requests.
“The chancellor’s decision to open the door to Greensill Capital has put public money at risk.
“There must be a full, transparent and thorough investigation into the chain of events that saw Greensill awarded lucrative contracts, the freedom of Whitehall and the right to lend millions of pounds of government-backed Covid loans.”
SNP Cabinet Office spokesman Stewart Hosie said Boris Johnson’s government was “stumbling from one scandal to the next”, adding: “The latest developments around Greensill Capital and access to Government departments granted to firms with close links to the Tory party has only raised further questions.
“Tory ministers and former prime ministers casually texting each other over government access utterly reeks.
“When MPs return from recess, Rishi Sunak must come before parliament and set the record straight over his full exchange with David Cameron and what the outcome of those messages were.”
Mr Cameron has yet to comment on any related accusations of wrongdoing.