This is indeed a very common question asked by owners of closely held corporations or LLC's. Lets answer your questions individually;
1. First of all is this legal?
Yes, this is legal,that is you can have a corporation that you own as a tenant for your wholly owned office or building. 2. How much rent can I charge?
The answer to this question is not 100% clear, but as far as IRS is concerned, you should attempt to charge fair market rent, using an arms length transaction method. I would recommend that you hire 2-3 real estate professionals to provide you with a estimate of rental value of the building and charge an amount equal to the average of the 2-3 rent estimates obtained from the Realtors. This is a conservative policy. 3. What are the risks to me in case there is an IRS audit?
The rental transaction itself will not trigger an audit in itself, but, if it appears that you are not charging fair market rent, or charging abusively high rent, not showing a profit in the corporation, the IRS will deem that you are circumventing the payroll taxes and recharacterize some of the rent into salary and assess penalties and interest on payroll taxes not paid, along with payroll tax liability that should have been charged. 4. Is this a common practice?
This is a very common practice and you should consult your CPA to determine if this is suitable strategy in your case.