US stocks end higher as tech shares rally