When I want the project to stop playing or recording, I press the space bar or click on stop.
The main annoyance for the issue referred to by the OP is when doing an export, because you need to select a range in the timeline. It would save a few seconds if you could just Select All, and the timeline would automatically extend no further than a "this is
really the end" marker.
It is true that ghost data, typically involving automation or controller data, causes the problem. You can generate ghost data if you let recording continue past where you want the project to stop, because SONAR doesn't know whether you're recording something intentionally or not.
Most of the time Delete Special, selecting all options, and selecting the timeline region past the "real" end point takes care of things, but not always. I'm not sure what renders this ineffective (I don't have this problem often enough to chase down the issue). However one possibility is a hidden track that extends past the expected point.
A "this is
really the end" marker would be convenient, but at least for me it's not a showstopper to Select All and drag across the timeline to define the area I want exported. It's easier than opening up the automation lanes and deleting the rogue node.