The effects of psilocybin typically last about four to six hours. In contrast, the most intense effects of MDMA generally last around 6-8 hours, followed by an afterglow that can last for several hours. Therefore, while both substances have different durations of peak effects, psilocybin has a longer overall duration of effects compared to MDMA. The peak of the effects of psilocybin is about 2 hours and this is comparable to MDMA.
You can also check these links for more information about the effects and duration of these substances: