Matt,
If your charging system (alternator and/or voltage regulator) has gone bad, you'll see the exact symptoms you've had. Your bike will run OK until the battery gets too weak to support the ECM or to turn the starter motor. Several people have mentioned the stator, which is part of the alternator. I noticed nobody has mentioned a voltage regulator problem.
When the engine is off, the gauge will measure the battery voltage, which is somewhere around 10 to 11.5 volts. With everything working correctly and the engine running about 2500 RPM, the voltage gauge should read about 14 volts; this shows the charging system output.
If your engine is running about 2500 RPM and the gauge still shows just battery voltage, you aren't getting anything from the charging system. This can be a bad alternator, bad voltage regulator, bad connections/wires, or any combination of these.
Replacing a voltage regulator isn't too hard, and is much easier than replacing the stator.