In order to gain the maximum amount of experience points possible, you must win all monster encounters available until obtaining a certain amount of gil from each of the two zones. You can open the menu to keep track of the amount of gil you obtained from the dungeon. Because the amount of gil you can collect is predetermined, it will indicate your progress in defeating all available monster encounters.
Stay in ZONE 1 until you have 5,652 Gil.
With Full Steal: 11,304 Gil.
Proceed to ZONE 2, defeat all encounters until you have 13,046 Gil.
With Full Steal: 26092 Gil.
Defeat the boss, you should have 14,246 Gil before leaving the exploration.
With Full Steal: 28,492 Gil.
You should conclude the dungeon exploration with a total of 14,622 Gil and 47,196 EXP.