This piece along with Sonata No.1 was written in 1894 after meetingt the clarinetist Richard Mühlfeld. Brahms retired already from composing at this time, but he was captivated by the beauty of the sound of the clarinet and that’s how the two sonatas as well as the trio in A minor, and the quintet in B minor were written.