Mr Fraser, who was appointed to the position in January 2015 by then Prime Minister Tony Abbott, will officially resign on 31 July.
He will be replaced by Philip Gaetjens, who was recommended to the Governor-General by current Prime Minister Malcolm Turnbull.
Mr Gaetjens has previously served as chief of staff to two Liberal treasurers including Scott Morrison and Peter Costello, encompassing 11 federal budgets.
He was also the secretary of the New South Wales Treasury between 2011 and 2015, having served as a senior executive in the Commonwealth Treasury, the Department of Prime Minister and Cabinet, and the South Australian Department of Treasury and Finance.
Mr Gaetjens was additionally the first director of the Asia-Pacific Economic Cooperation Policy Support Unit in Singapore between 2008 and 2010.
The incoming Treasury secretary was set to to become Australia’s ambassador to the Organisation for Economic Development and Cooperation (OECD), but the government will be appointing a replacement.
Speaking of Mr Fraser’s premature departure, the Prime Minister said: “In the last three and a half years in the role as Treasury secretary, Mr Fraser has led Treasury to new heights, especially in the areas of corporate and personal income tax reform.
“He has strongly supported the government’s efforts to help repair the budget. He has been a trusted adviser to the Treasurer, ministers and myself on key economic matters.
“On behalf of the government, I thank him for his service to the Australian community and our economy.”
The assistant minister to the Treasurer, Michael Sukkar, also commented on the changes, saying: “I pay tribute to Mr John Fraser who, after three and a half years, has resigned his role as secretary of the Department of Treasury.
“During his tenure as secretary to the Treasury, we have seen major economic reform, most notably personal tax relief for all Australians and more competitive tax rates for small and family-owned businesses.
“I am particularly thankful for the work we conducted on the housing affordability package announced in last year’s budget. This package — along with further reforms in this year’s budget — have provided greater access for aspiring new home owners, greater supply of affordable housing and stability in the market.”
He continued: “On a personal note, I thank John for his valued insights, advice and friendship. I wish him well in retirement and all future endeavours.
“Finally, I congratulate Mr Philip Gaetjens on his appointment as the next secretary of the Department of Treasury.
“I look forward to working with Philip in the future as the government works towards improving the lives of all Australians.”
Labor shadow treasurer Chris Bowen wished Mr Fraser well, but criticised his replacement, saying that the appointment would be “unlikely to restore faith in the Australian Treasury after years of politicisation by the Liberal Party and by Scott Morrison in particular.”
He accused Mr Morrison of “regularly” using Treasury to cost Labor’s economic and tax policies, then releasing the costings to certain media outlets to “damage” the Labor Party.
Mr Bowen continued: “Over the last two decades, Mr Gaetjens has spent a lot more time in Coalition Treasurers’ offices (13 years), as chief of staff to [Mr] Costello and [Mr] Morrison, than in the Australian Treasury (four years).
“Despite this appointment coming on the eve of a general election, when Treasury (with finance) produces the Pre-Election Economic and Fiscal Outlook, the Treasurer did not bother to consult with the opposition.”
The shadow treasurer concluded his statement describing the Treasury as a “fine institution that deserves the best people and processes and not the constant politicisation that Scott Morrison has subjected it to”.