It's exactly two songs, no matter how long the songs are (what if one of the songs is a 30-minute symphony)? It gets the end of the second song before turning off? Or are you saying it lasts about the length of two typical pop songs, and cuts off in the middle of a song?
If the actual time between start of play and cut off is always consistent, it sounds like the shuffle is "timing out" and going into "sleep" mode. Like it does not sense that headphones are plugged in and playing audio.
First, confirm that the headphones plug is fully inserted into the headphones jack. The fit may be tighter than expected. If it's not completely plugged in, you may still get some audio, but the shuffle may think there are no headphones connected to the jack, so it goes to sleep.
If that's not it, as a test, try connecting a different set of standard headphones to the shuffle, any kind, preferably not one with remote control buttons on the cord. Is there any difference when using different headphones?
In case this is a software issue, you can also do a Restore in iTunes on the shuffle. The Restore button is on the shuffle's Summary screen in iTunes. This will erase the shuffle, re-install its software, and set it to default settings. You can then re-sync the shuffle and try it again.