A sonata is written for a solo instrument, either alone or with piano accompaniment. A concerto sets a soloist against a full orchestra, and the contrast between the two forces is the point of the form. Both are usually in several movements; the difference is who is playing.
The core difference
Both are multi-movement instrumental forms. The scoring separates them.
- sonata — solo instrument, often with piano: a violin sonata, a piano sonata.
- concerto — soloist plus orchestra, built on the contrast between them: a piano concerto.
Sonata form, which is a different thing
Confusingly, sonata form is not the same as a sonata. It is a structure — exposition, development, recapitulation — used for individual movements in symphonies, quartets and concertos as well as sonatas. A concerto's first movement is very often in sonata form.
Related forms
A symphony is for orchestra without a soloist. A concerto grosso sets a small group of soloists against the orchestra rather than one player. Sonata comes from Italian sonare, to sound — originally distinguishing played music from cantata, sung music.