All perfect praise be to Allah, The Lord of The Worlds and may His blessings and peace be upon our Prophet Mohammad and upon all his family and companions.
It isn`t permissible to use the land which is endowed for the benefit of the mosque against the purpose for which it was endowed since the condition of the person who endowed it equals the evidence established in the Sharia texts. In principle, an endowment shouldn`t be sold, gifted, or inherited; rather, it should observe the purpose for which it was endowed. Ibn Umar reported: "Umar acquired a land at Khaibar. He came to Allah's Apostle (PBUH) and sought his advice in regard to it. He said: Allah's Messenger, I have acquired land in Khaibar. I have never acquired property more valuable for me than this, so what do you command me to do with it? Thereupon he (Allah's Apostle) said: If you like, you may keep the corpus intact and give its produce as Sadaqa. So 'Umar gave it as Sadaqa declaring that property must not be sold or inherited or given away as gift. And Umar devoted it to the poor, to the nearest kin, and to the emancipation of slaves, aired in the way of Allah and guests. "{Bukhari and Muslim}.
Muslim scholars have stated that violating the endower`s conditions isn`t permissible. Al-Imam Ash-shirbini said: "In principle, the conditions of the endower should be adhered to so long as they don`t go against the purpose for which the endowment was endowed in the first place."{Moghni Al-Mohtaj, 3/540}.
A mosque is a place of prayer and worship; therefore, the above land can be used to expand it, its parking, its lavatory and the like.
In addition, the aforementioned utilities pertain to the mosque ; whereas, the graves don`t, so it isn`t permissible to use that land against the purpose for which it was endowed. And Allah knows best.