Actually the answer should be:
Twice (and both times in the same episode:
"By Any Other Name".)
In that episode they successfully crossed it once to exit the Milky Way galaxy and then crossed it again (although that was not shown in the episode, but definitely HAD to occur as they re-entered the Milky Way galaxy.)
In
"Where No Man Has Gone Before" they successfully entered it, but immediately turned around and exited back the way they came (IMO this doesn't count as 'Crossing the Barrier'.)
As others have mentioned, in
"Is there In Truth No Beauty" there actually is some dialogue from the visiting Enterprise designer that he DID take the ship into the Galactic Barrier; but something else happened, and they were trapped in some void that they couldn't navigate out of using Humanoid senses or instruments. Again, IMO that doesn't count as 'Crossing the Barrier'.)