Mohan, who has edited the paper since 2009, will take up a senior role advising the chief executive of News Corp.
Dinsmore, who is currently News International's director of operations, will take over as editor of the red top from Monday.
A statement said Mohan will advise the chief executive of new News Corp - formed after Rupert Murdoch decided to split its newspaper and entertainment operations.
The new company will officially be incorporated next Friday, the organisation said, and Mohan will be tasked with exploring opportunities for it across Europe.
He will be based in London but will report directly to Robert Thomson in New York.
Mohan, who has been with the Sun for 17 years, said: "It has been a real privilege to edit the Sun, an intrinsic part of modern Britain, loved by its readers and unmatched by its rivals.
"I am proud of the way we have informed and amused our readers in recent years and also campaigned on their behalf in difficult economic times.
"I would like to thank my peerless staff for the creativity and spark they have brought to the paper day after day.
"I am confident The Sun will go from strength to strength, and now look forward to a new challenge of helping a brand new company find its feet and build a strong future for its journalism across the globe."
He will be replaced on Monday by 44-year-old Glaswegian Dinsmore, who worked his first shift on the paper at the age of 22, the statement said.
He became editor of the Scottish edition in 2006 and was promoted to general manager of the company's operations in Scotland in 2010.
After a brief stint as the managing editor in London, he joined the executive of News International last October as director of operations.
"There is no better job in journalism than editing Britain's most popular paper," he said.
"I relish the opportunity to build on the historic strengths of the Sun, and harness new digital opportunities to offer our loyal readers more than ever."
News International chief executive Mike Darcey said: "Dominic brought real imagination and flair to The Sun, maintaining its formidable reputation for exclusive news, sport and showbiz with wit, wisdom and insight.
"David Dinsmore is ideally placed to take the team to even higher levels. He has a proven track record on the paper over two decades and has recently helped steer the Premier League project with great skill and vision.
"These are exciting times for our company, with new leadership on all our titles and an executive team that has been transformed in recent years.
"We will join the new News Corp next week in a strong, determined and confident position and I have no doubt that we will secure a sustainable future for the world-class journalism we all cherish."