"I am planning to sell a home I own in a foreign country I lived before, and to transfer the money to my bank account in US. How do I declare this for IRS? Do I have to pay taxes on this transaction? Thank you."
You will need to report the tax on the sale of your home just like everyone else. If this real estate was your principal residence and you both lived and owned the house for at least 24 months, then you can exclude $250,000 of gains (or $500,000 in gains if you are married and file a joint return). If the house was a rental property, you'll need to calculate your gain using the rules for selling rental properties. Gains on a primary residence in excess of the exlusion amount will be taxed as long-term or short-term capital gains, depending on how long you have owned the house.
You will also pay taxes on the transaction in the foreign country you are living in. Those taxes can be claimed as a tax credit on your US tax return using the Foreign Tax Credit. You cannot claim a foreign tax credit based on any gains you excluded under the provisions of Internal Revenue Code Section 121 (the $250,000 or $500,000 exclusions).
By reporting your gains and any exclusions on your tax return, you will have sufficient documentation to establish why a significant amount of money is being transferred into your US bank accounts. Also, don't forget to report your foreign bank accounts using Treasury Department Form 90-22.1. As a practical matter, you may also want to show your US bank a copy of the escrow statements showing the sale of your home in case they have any questions about the source of this money.