The answer is as clear as it looks at first sight: 'conversations, which were essential to sanity'. This is grammar to do with the architecture of the comma. 'Coffee breaks' is too distant to intrude.
I suppose that the potential difficulty, and the reason you are asking this question at all, is that some people are not skilled readers. If you really want to guard against that, then I agree with Graffito's comment: you can smoothly rewrite the sentence. Maybe something like...
My gratitude goes to my dear friend for turning our coffee breaks into
interesting and thought-provoking conversations. Those exchanges were
essential for sanity, under the circumstances, and I also learned a
great deal from them.
It's a basic essay-writing Thing. If your sentence becomes in any way cumbersome, then just turn it into two. If it can't survive that, then there is probably something wrong with the point that you are trying to make.