A lot of factors play into a bank's decision to give you a loan, but there are some general rules of thumb. For starters, having a good credit history, as shown through your credit score, will not only increase your odds of getting approved, but will also lower the interest rate you pay on your mortgage.
Most lenders want a 28/36 debt-to-income ratio, but that varies based on your down payment, the type of loan and other factors. What this means is that housing costs should not exceed 28% of your total income and no more than 36% of your monthly income can go towards paying debt (including your mortgage payment).
For example, let's say you make $60,000 per year, or $5,000 per month. You're looking at a home that, after your down payment, will cost you $1,200 per month. That keeps you below the 28% threshold most lenders require. But you also have a $300 per month car payment, a $350 per month student loan payment and a $100 per month credit card payment. Now your total debt, counting your mortgage, is $1,950 per month, or 39% of your total income, which puts you above the 36% threshold.
Calculators like this one from Redfin are abundant online and can give you a good idea of what price range you should be looking in as you start your house hunt. Keep in mind these are guides and you should talk with your lender for a more accurate estimate of how much house you can afford.