Broadly speaking, people make two errors when training - doing too little to be effective (ranging from nothing to not enough), or do too much to really benefit (ranging from too much to recover from to too much to do without getting injured).
But the goal of exercise is to hit that sweet spot in the middle, where you are doing enough to get to where you want to go, but not so much you can't recover from the workouts.
To borrow a term from medicine, the goal of exercise is the minimum effective dose. That is, just enough exercise to get the results you want.
If 3 sets of a weight is enough to get you to your goal, you want to do 3 sets. Two isn't enough, and if you don't need to do 4 to get there, why do four? It's like accelerating towards a red light that'll still be red when you get there - it wastes gas and doesn't get you to your destination any faster.
How to tell can be hard, and means you need to track your workouts and track your progress. But although it can be hard to identify, it doesn't change that fact - the goal is to do just enough to get the most progress towards your goal and not any more or less than that.
This isn't easy.
It's very easy to get caught up in trying for the maximum effective dose. That's the most exercise you can do while still getting some benefit from it. It's doing so much exercise that you're reached the end point of utility but are still getting something from it.
Past that, and you get to ineffective exercise.
The bodybuilding great Lee Haney famously said, "Stimulate, don't annihilate." It's very easy to push past stimulation and head towards annihilation. If 3 sets are good, 6 sets much be great, and 9 sets much be amazing! The more your body screams at you to stop, the more benefit you're getting from the workout. After all, pain is weakness leaving the body.
Except it isn't. Like Lee Haney said, the goal is to stimulate growth. Pain isn't weakness leaving the body - discomfort and exertion is weakness leaving the body. Pain is a warning sign of injury and unacceptable levels of stress entering the body. It won't respond by getting stronger, but by breaking down - because you're not leaving it the resources (time off to regain and super-compensate) to do so.
If this wasn't the case, if pain was really the sign of a good workout and pushing until you literally can't continue was the basis of progress, then every MMA fighter out there would be an endurance god. Every teen to twenty-something male would have 25" biceps. Every jogger would knock off marathons like warmups.
Notably Dave Tate once wrote about fixing someone's bench press, and saying the first thing he does is get people to stop doing extra triceps exercises for a few weeks. That's the first fix - see if they're doing too much. Give them some extra recovery and less stress on the muscles involved and see what happens.
Psychologically this can be hard - no one (including myself) wants to go home leaving an opportunity to progress towards the goal behind. You don't want to "bag" a workout or slack off, and it's easy to mistake hard work (or just more work) with more progress.
But it's worth reminding yourself, the goal isn't to do the most and still make progress. The goal isn't even to do the most to make the most progress. The goal is to do the minimum you need to do to make the most progress. And if you can't figure out where "enough" and "too much" are, it's better to err on the "not quite enough" side - it's easier to add a bit later than to get extra sleep, extra recovery, and to heal up injuries faster.
So never push to or past your limits?
Not at all. You always need to be pushing past your limits to grow. You need to be striving, even if only striving to keep what you've got. What you just can't do is push past your ability to recover from and benefit from the workouts all the time. You grow during the time between workouts, and you always need sufficient recovery time to balance out the workouts - you can't beat your body into extra recovery by increasing demand.
This isn't to say that occasionally over-reaching isn't productive. Sometimes it is - in the same way that someone on a fat loss diet may have a higher-calorie or "cheat" day can benefit from a sudden spike in calories followed by a return to normal eating patterns. It's the disruption of the body's homeostasis - its attempts to keep everything the same unless forced to change - that makes that work. But in order for it to be useful it must be coupled with plenty of days where you are eating less than you need to take in to maintain, thus getting you to your goal.
You can't get very far with cheat days every day, or by overreaching every day. It works when you overreach your body's recovery and then give it extra recovery (spike the workout, spike the recovery).
But what about (Boot camp/Soviet-era Olympic camps/SEAL training/whatever)?
Don't mistake a selection process for a training process. A lot of famously effective programs for weeding out the unfit for the task are just that - programs for weeding out the unfit for the task. They're not programs meant to build up the participants but winnow out anyone who isn't ideally suited for a specific task that only needs doing by a very small group of people. Those processes can be nothing but overreaching on a daily basis to see if you break down. It can do nothing but annihilate instead of stimulate. The goal isn't improving but selecting for survivability and willpower (or for Soviet-era Olympic camps, the most perfectly adapted to the needs of that specific sport). And even then, once you make it in to the military or onto the team, they start to program in a lot of recovery to balance out the training - and use every tool in the world at their disposal to get you the minimum effective dose for the optimum benefit from training.
Keep this in mind while you train - are you doing as much as your body can take, or as much as your body needs to get to reach your goals?
Demonstrating vs. Training Strength