Can God heal mental illness? YES! That's called "a miracle." It's called a miracle because it is outside the norm -- the way the universe is set up to work.
Does God always heal mental illness? No. If he did, then it wouldn't be a miracle, it would be the norm of how the universe is set up.
Mental illness is no different from any other ailment, albeit, it must be more frustration then some other ailments. If it's a problem, God can fix it.
Does he always? No more than he fixes any other problem. "Miracle" means something special.
Does that make God not a nice guy then? Well, yes and no. God's not a guy, so there is that. He's God. Is he nice? Sometimes. He's wrathful other times. What he is fulltime is perfect (that's what holy means) and just. And what he expects equals who he is fulltime -- perfect and just.
Perfect is going to bite us. When we sin, we become the opposite of perfect. We sin often! One sin is enough. And God being God he cannot hang with imperfect/sinners/man. (The three words all fit under one word in Ancient Hebrew -- six. Six is the number for imperfect, sinful, man.)
BUT he has a special heart for Man. He really likes us in general. Picky on who he loves specifically. (And it has nothing to do with us. It has everything to do with his choices, so if we are his, we're not special in ourselves; we're special in him.)
God being perfect, he made a way to see some of us as "perfect" to. Through Jesus Christ (both God and Man) dying on that cross as a substitute for us. And after he died he went to hell to redeem those who were to be God's people too. He sees Jesus in those of us whom he has chosen, so he sees perfect.
Make no mistake. We ALL deserve separation from God, death, and hell! That is the righteous judgement from the perfect God on the sins we have done/are doing/will do. He pulled some people out of Death Row by having Jesus die in their place. Can you think of anything nicer since we deserve Death Row? So... nice God!
Miracle? Even nicer, but not a guarantee.
We are healed by his stripes (the whipping he got before he was crucified) in that he has taken away our biggest disease -- our sin nature.
If we are his, the rest of our sicknesses, diseases, ailments, and shortcomings will leave one day, but that day is when we get our new bodies to enjoy him forever in eternity.
I don't know why he doesn't heal everyone. I do know why he hasn't healed me of my disability. I'm naturally arrogant. Put me on a long leash and I'm sure I'll go back to thinking, "I'm doing this all by myself. I don't need God."
He put me on a short-leash -- my bad back that keeps getting worse -- to remind me I need him in all things... right down to doing dishes! Good deal. Short-leashes reminds me who I belong to more often. I've got the brain of a sieve, so I need the reminder often. Constant pain is a good reminder.