Leibniz’s Discourse on Metaphysics opens with a proof logically equivalent to the Fourth Way:
Whatever is more and less with no greatest possible is not more and less perfect
So (by contraposition) whatever is more and less perfect is such relative to the greatest possible perfection.
His first claim is supported by an insight into numbers, which admit of no maximum and are not better or worse by being more or less. We can hit the same conclusion by considering privations: if a threshold has to be the same width as a 30” door, there is no maximal way it can fall short of being that size, since falling 30″ short would leave one with no threshold at all. And so if anything is better and worse, there must be some greatest possible perfection.
The Augustinian tradition established that the greatest possible perfection is God. In giving a critique of idolatry, Augustine pointed out that if one could think of something better than the object they were considering, then the object they were considering was not God. So by the same contrapositive move Leibniz made, God is the object than which nothing greater can be thought.