Lehman, 51, will step down nearly to 15 years at Sun and will take on part-time teaching and mentoring duties at the company.
He will be replaced by Steve McGowan, vice-president of finance, planning and administration for global sales operations at Sun. McGowan has been at the company since 1992.
The transition should be completed by 1 July at which time McGowan will report directly to Scott McNealy, chairman and chief executive officer at Sun.
Lehman's departure followed the decision made by John Shoemaker, Sun's executive vice-president for computer systems. Shoemaker said last week that he will also retire in July and turn over his duties as head of the processor and server groups to three Sun executives.
Lehman will leave Sun during one of the most tumultuous times in the company's history. Sun made its first mass layoffs last year, as server sales dried up. The company has posted losses in recent quarters but Lehman has said Sun should return to profitability in its next quarter.
Lehman, also an executive vice-president, oversaw Sun's finance, legal, real estate and information resources functions during his career.