Question: Do I need to use **any** or **the** before **other** in the following sentence when comparing things?

Here are the examples: 

* Moscow is bigger than **any other** city in the world.
* Moscow is bigger than **other** cities in the world.
* Moscow is bigger than **the other** cities in the world.

Some more examples:

* John is taller than **other** boys.
* John is taller than **any other** boy.

Answer: 
All of your sentences are grammatical, whether **other** is preceded by **any**, **the**, or nothing at all.

I, personally, find the second sentence the most natural, followed closely by the first, and, finally, the third. But all sound quite natural to me nonetheless.

Of course, that's subjective. Different people will have different reactions to them.
Where **Moscow** is concerned, your first example is idiomatic (regardless of whether you are referring to the size of the population or the extent of the city). That's how most people would construct the sentence.The other two are grammatically correct but unusually phrased. 

Native English speakers would be unlikely to use them except in certain hypothetical contexts such as: *Moscow is smaller than the vast metropolis on the moon but it is bigger than other cities in the world.*

Where John's height is concerned, both examples are correct and idiomatic but likely to be used in slightly different contexts, for example:

> 
> John is taller than other boys of his age
> 
> 
> John is taller than any other boy in his class
> 
> 
> 

The choice here is a matter of nuance and preference.