Do I need to use any or the before other in the following sentence when comparing things?
It's not the presence of the comparative that determines the use or non-use of the article, but pragmatics, or context.
In your first set of sentences (next time, please number them), this one:
- Moscow is bigger than the other cities in the world.
makes no sense, because, even though the number of cities in the world is not infinite, there are so many that it would be absurd to restrict them by using the definite article.
To express your idea, it'd be more logical (and correct) to use the superlative:
- Moscow is the biggest city in the world.
In your second set of sentences:
- John is taller than other boys.
- John is taller than any other boy.
the first one makes more sense. The second one sounds like an exaggeration on the part of the speaker, and would be more reasonable if some restrictive structure were added, for example:
- John is taller than any other boy I know.