Stocks finished higher Friday, lifted by the volatile artificial intelligence trade, leading the market to the upside for the week.