The Torah explicitly states that kings should refrain from having many wives (Devarim 16:17):
וְלֹ֤א יַרְבֶּה־לּוֹ֙ נָשִׁ֔ים וְלֹ֥א יָס֖וּר לְבָב֑וֹ וְכֶ֣סֶף וְזָהָ֔ב לֹ֥א יַרְבֶּה־לּ֖וֹ מְאֹֽד׃
And he shall not have many wives, lest his heart go astray; nor shall he amass silver and gold to excess.
At least according to the Sefer HaChinuch (mitzvah 501) which cites Sanhedrin 21a a king is permitted to marry up to 18 wives. I have picked this source, but there may be other opinions that disagree with the number 18; that may very well affect the outcome of this answer.
As far as I know, King Solomon had many more. In view of the above, how did he find a permission to do so? From some of the links below, it is suggested that to maintain peace this was a 'standard practice' and (I guess) overrides the prohibition of kings having many wives? I don't quite understand this line of reasoning, because there are many mitzvot that one could argue would ensure peace if only we transgress them somehow.
There may be other kings who also had more wives; I would be interested to hear a line of reasoning pertaining to those kings as well.
Note: from what I can see, other questions (How did King Solomon and King David keep up his duties to his wives, Questions about Polygamy in Jewish Law and Culture) generally deal with polygamy, but this question is specifically related to the prohibition against kings having many wives.