The Middle Kingdom , 2040 1801 b.c. , commenced with Theban rulers of the 11th Dynasty attempting to extend their control , and Egypt was reunified under Mentuhotep II .
The Middle Kingdom ended in 800 BC .