Here are some thoughts (for free, so not in enough detail to act upon without further legal advice):
- Hire a tax lawyer. The amount you save in taxes will pay for itself.
- If feasible, delay the execution of the sale until you have held your company for more than 1 year.
- Consider selling your company for stock of the acquiring company instead of for cash. The transaction would be fully tax free if solely for stock, and taxable only to the extent of cash/non-stock received. (See IRC 368, and related sections.)
- If you made the S election, you must unelect for Small Business Sale Exclusion to apply. This has fun tax consequences.
And finally, DO NOT HIRE A CPA to do this for you. CPAs know how to add things up, but they frequently get the law wrong. Tax lawyers exist largely to clean up the mess created by CPAs.