Gold futures log first gain in three sessions