My answer is based on canon facts, but, as far as I know, I don't think the mechanism was ever explained. The wiki on the Poke Ball mechanism agrees that the mechanism is unknown so far.
As my own speculation, I'd say it might have something to do with the closing mechanism. As we can see in chapter 38, Giovanni damaged Red's Poke Balls' shutters during his gym fight, preventing the Poke Balls from opening and trapping Gyarados and Venusaur inside until the balls were repaired. The shutter must be key to catching/trapping a Pokemon in the ball. It might thus be the case that Ultra Ball has a more advanced or stronger lock than a regular Poke Ball, making it harder for the Pokemon to open the lock and escape from the ball. With the Master Ball having the perfect lock, as not even Mewtwo could escape after being caught by Red, in chapter 35, while still being at almost full power.
As we can see, the Poke Balls are empty inside. The only thing it seemingly does is shrink the Pokemon. There is no inducing gas or anything inside to weaken the Pokemon. Pokemon do undergo a change in character when being caught though. We have seen the most bad-ass Pokemon turn into loyal servants/friends after being caught. But this might be due to the Pokemon's honour submitting to its defeat, or it might be that the Poke Ball actually does something to the Pokemon during the bounce process. We don't really know the correct answer to this so far. Again, Mewtwo could be seen as a good example, as he didn't start rampaging after being released from his ball, but he came to respect his trainer Blaine.