It states in the 364th prohibition that a king is forbidden from having too many wives.
The limit is that he may not have more than 18 wives legally bound by kesubah and kiddushin.
The details of this mitzvah are explained in the second chapter of tractate Sanhedrin. Whenever he adds on to this limit, he is punished by lashes.
Was Shlomo Hamelech lashed for taking more than 18 wives, and if not, why not?