Markets gain ground for second straight session