Implementing an asynchronous callout using the Continuation class is the optimal solution to handle long response times and avoid timeouts in Salesforce. It allows the Apex code to make a long-running request to an external service and free up the thread to serve other requests.References: Apex Developer Guide - Asynchronous Callouts