I'd have expected it should rather be 2 hours, 4 hours max. So can top in this context be used like a synonym for max? Is this a common phrase?
The correct way to write the sentence is actually:
"It will take 2 hours; 4 hours tops."
Note the plural—"tops", not "top."
I can't comment on the evolution of the phrase, but here "tops" is indeed used to mean "maximum". It will take at least 2 hours, but no more than 4. This is indeed proper English, and is quite common.
I don't object to your suggestion of "...4 hours max" (or maximum), though. That would be perfectly well understood. But I think "tops" is more common.
Ah, edited to add—if ngrams are to be believed, my guess that "tops" is more common is not quite correct. It seems the two are fairly equal in recent history: