US stocks close higher to extend gains