These are general lending guidelines: To each is own....but 40% is high in my personal opinion but it is all about protection. If you can have a minimum of 6 months of payments saved away I think it is worth the risk.
Your monthly mortgage payment -- including principal, interest, real estate taxes and homeowners insurance -- should not be more than 28 percent of your gross monthly income (before taxes). This is your housing expense ratio.
Your total monthly debt obligation should not be more than 36 percent of your gross income. Total debt includes the mortgage payment plus other obligations such as car loans, child support and alimony, credit card bills, student loans, condominium association fees. (Note: Government and certain other lenders may be more lenient.) This is your debt-to-income ratio.