Dealing with competition from inside the lab
Science is a collective endeavour to build and spread knowledge, improving our understanding of nature. Collaborating and building on each other's expertise with proper recognition is a must.

You collaborated with a colleague of yours, and not only did this joint effort  produce a better result, but it also produced a further result, unforeseen at the beginning (and which, for you, came almost for free).

Celebrate the successful moment, hope that all your future collaboration will work out smoothly and productive as this one, and if necessary rethink carefully at your motivation in doing science, to avoid being stressed by something that should be the normality (and that too frequently, alas, is not). That is, be competitive against yourself to improve yours and everyone's knowledge and not against someone else.