A synagogue is endowed with a status of Kedusha (sanctity) which results in limitations on one's conduct in a synagogue. Any behavior that infringes upon this quality of Kedusha is forbidden.
Chacham Ovadia Yossef Shlita, in "Halichot Olam" Helek 1 Page 262, writes that one may nevertheless conduct a Se'udat Mitzvah in a synagogue. A "Se'udat Mitzvah" is a meal that constitutes a Mitzvah, such as a Siyum Masechet (celebration held upon the completion of a Tractate of Talmud), the meal conducted after a Brit, and a Shabbat or Yom Tov meal. Therefore, if for example, a Se'udat Mitzvah is held in a synagogue's social hall but the hall cannot accommodate all the guests, it is permissible to set up tables in the Sanctuary to provide additional space.
Chacham Ovadia Yoseph however points out one very important rule on this subject. Although it may permissible to engage a Seudat Mitzvah in synagogue, it nevertheless is forbidden to have the Se'udat Mitzva in a synagogue if it will include excessive drinking of alcoholic beverages – such as a Purim meal – which would lead to frivolous behavior. This ruling is based on a comment of the Ben Ish Chai (Rabbi Yosef Chaim of Baghdad, 1835-1909) in Parashat Vayikra Ot 4, that one may not conduct in a synagogue a Se'udat Mitzva involving "Shichrut" – intoxication. The Kaf Ha'chayim (134) remarks that this applies only to meals involving excessive drinking. If the participants merely drink small amounts of wine, such as for Kiddush, then such a meal may be conducted in a synagogue.
In conclusion, a Se'udat Mitzvah, such as a Shabbat meal or Siyum Masechet, may be held in the synagogue, so long as the participants avoid excessive drinking of alcoholic beverages and frivolity, and temper their joy with a sense of reverence and respect for the sanctity of the synagogue.