Diesel and gasoline both rose for the first time in six weeks, with diesel gaining 3.3 cents to $2.961 a gallon, the Department of Energy said.