What is the difference between an arhat, bodhisattva and a buddha? What is the difference between an arhat, a bodhisattva and a buddha? References to the scriptures would be most helpful.

I'm open to both Theravada and Mahayana perspectives.
According to the Prasangika-Madhyamika Mahayana school of Tenets,

A Hinayana arhat abandoned afflictive obscurations by way of realizing emptiness, but has not abandoned knowledge obscuration. He as achieved abiding nirvana. Therefore, although they are free from the conception of true existence, and from true suffering, they are not free from the imprints of ignorance (i.e. knowledge obscurations). We say that it is like removing garlic from a container: the smell will still be there. So, because they still have the imprints of ignorance, (1) they are not free from the appearance of true existence, and (2) they are reborn with a mental body, due to the imprints of ignorance (in our case, we are reborn to due karma and afflictions).

In his commentary to Maitreya’s Sublime Continuum: The Essence of a One Gone Thus, Gyaltsab Je says:


  For the Hearer and Solitary Realizer arhat, because they do not meditate on the perfection of wisdom.
  It means that although Sravaka and Pratyekabuddha arhats cultivated the wisdom realizing emptiness, their wisdom is not conjoined with bodhicitta. Therefore, it is not a perfection of wisdom.


Commenting Gyaltsab Je, Geshe Jamphel Gyaltsen said:


  Bodhisattvas, hearers (shravakas) and solitary realizers (pratyeka buddhas) arhats do have realizations of reality, but they do not realize it in the same way as a buddha.


And:


  The Hinayana arhats and bodhisattvas on the three pure grounds, are reborn due to uncontaminated karma that propels them to take birth and their body is a called a mental body.



A bodhisattva is a person who generated effortless bodhicitta (the wish to achieve enlightenment for the sake of all sentient beings). Since effortless bodhicitta is the entry gate to the Mahayana path, he entered the Mahayana small path of accumulation. When he cultivates wisdom, it is conjoined with emptiness and that makes his mind vast (due to bodhicitta) and profound (due to realizing emptiness). He wishes not to abide in individual liberation (abiding nirvana) but to be free from the extreme of peace (abiding nirvana) as well as from samsara. Therefore, he wishes to achieve non-abiding nirvana, which is the attainment of a buddha.

We say that in terms of wisdom, a Hinayana arhat is more powerful than a bodhisattva before the 8th bhumi, because he abandoned afflictive obscurations while the bodhisattva abandons them from the 8th ground.

Geshe Jamphel Gyaltsen said:


  Having generated spontaneous bodhicitta the bodhisattva has entered the Mahayana path [the path of accumulation] and the cause is great compassion, the concern for all sentient beings. He blocks the two extremes in two ways.


The Lam Rim, Shantideva’s Bodhisattvacharyāvatāra, Asanga's Bodhisattvabhumi,  and Maitreya’s Ornament for Clear Realization  explain well what bodhicitta is, how it is the entry gate to the Mahayana, etc.


A Buddha abandoned both afflictive and knowledge obscuration, having generated the path perfection of wisdom (the wisdom of emptiness conjoined with bodhicitta). In his continuum, wisdom and bodhicitta are the same mind: the omniscient mind of a buddha that realizes all objects of knowledge directly, past present and future, in an unmistaken way, etc. He achieved non-abiding nirvana, abiding neither in samsara nor in individual liberation. His enlightened activities are uninterrupted.

Maitreya’s Sublime Continuum explains the two bodies of a buddha that can also be divided into three, four, or five.