Hello. I normally try and stay out of the "stopping power" debates as some get pretty heated up and I'm not sure they change anyone's mind, but will comment on your question as it relates to me personally based on the admittedly statistically limited personal experience with both calibers and the Browning P35 pistol.
First, I believe that there is much "ballistic overlap" between some of the best 9mm loads and some of the .40 loads.
However, the fact remains that the forty will throw bigger, wider bullets at speeds similar to 9mm rounds. For example, a nine will toss out at 147 gr bullet at something under a thousand feet per second while a forty will do the same with a 180 gr bullet. A standard pressure 9mm 115 gr Winchester STHP gets around 1200 ft/sec while about the same velocity can be had with a forty caliber Winchester 155 gr STHP. You get the idea. I'd guess that in just pure "power," the forty can edge out the 9mm.
That is not to say that the nine is anybody's "weak sister" as is sometimes said. With the ammo available today, I think the 9mm rates an adequate "stopper." It has enough if properly placed, but I think that's true with any of the commonly-used defensive rounds, i.e.: they'll all do it if you hit vitals and none have enough if you don't if you're counting on stopping the attacker for physical reasons rather than psychological ones.
An officer under my command was forced to shoot a guy trying to kill him. The round was a 124 gr 9mm +P+ HydraShok. It was a one-shot stop and the bad guy was dead right there. He dropped instantly from the heart shot.
Some years later, another officer was hit in the lower torso with a 180 gr .40 JHP and while he was in very, very serious condition and lost a kidney as well, he was told that he might ought to sit down right after the shooting. He was NOT disabled nor in any really apparent discomfort; that did soon change, however.
Placement is the primary determinant to stopping power. Power is certainly a component of whatever the equation is, but I just don't personally trust any 9mm, .38, .357, .40, or .45 round to do its part if I cannot do mine. Even with really good hits, many do NOT instantly cease whatever they were doing to get shot for in the first place; there is a time lag of several seconds.
The Browning Hi Power remains my favorite all around pistol after about 30 years use, but the 1911 is soooooooo very close that on one day, it might be my "favorite" and the next day take second place again to the HP. While it could be from extensive use of the 9mm, I just didn't like the way the slightly wider slide and heavier .40 HP felt. Others do. I just went with what I liked best in that pistol and it was the 9x19mm.
Confidence in one's chosen defensive caliber is important in my view. There's so much we cannot control in a deadly force scenario that much emphasis is put on those things we can like the make/model and caliber of the gun for those having a choice.
We can also pick the load for the given caliber and as we all know there's much discussion over what constitutes the "best" caliber and load for same. I'd suggest that if you pick something in 9mm,
.38 Super, .357 SIG, 9x23, .40 or .45ACP in autos, and learn to get hits with your choice at speed, you'll find that you do have "adequate stopping power".........probably! We ask much of our defensive calibers in terms of decking a 200 lb felon when men have been known to take rifle hits w/o "stopping" on occassion.
I reckon what I'm saying is that if you can get the hits with your forty and feel more confident in it than a 9mm, go for it. If you feel like you hit better with the 9mm and "trust" it to do the job, go for it. Where and what you hit will likely make the difference assuming that the bad guy doesn't "stop" because he wants to, but because he has to.