This is one of the so-called seven Rabbinic mitzvot, together with e.g., saying Hallel, washing hands before eating and reading the Megillah on Purim.
chabad.org gives background (here)
G‑d gave the Jewish nation 613 mitzvahs in the Torah. There are seven
additional mitzvahs that the prophets and rabbis of the ancient
judicial courts initiated during the first millennium after the giving
of the Torah on Mount Sinai. The rabbis also instituted many
additional decrees for the purpose of preserving the original 613
commandments.
When a rabbinical court institutes a new mitzvah or decree, and it is
accepted among the Jewish nation, it becomes a part of Torah and
Judaism. In fact, the Torah states, “According to the law they [the
rabbinical courts] instruct you and according to the judgment they say
to you, you shall do; you shall not divert from the word they tell
you, either right or left.” Thus the Torah commands us to heed the
instructions of the great rabbinical courts.