My betta Beau has been doing this for over an hour. He starts in front of his cave, goes all the way to the thermometer, swims to the top of the tank, goes back to the cave and does it all over again. I'm generally inclined to believe he's just being a goofball, but I wondered if there was a specific reason.
A betta doesn't always flare when he thinks he sees another betta. He probably just keep catching glimpses of it and and swimming back and forth to check it out because he's curious. Or glass surfing because he's bored.
I'll try fasting him for a few days and see what happens. He hasn't looked bloated, and I've been watching how much he eats carefully. (On a side note, does anyone else's betta attack their food? Beau lunges at it!)