At one time, I was bored because of a delayed flight and that question arose in my mind just for curiosity. I haven't observed any mechanism that checks or counts the passengers who get on the aircraft, so there is a possibility of abuse.
I guess airport security is responsible for that. The passenger may try to get on another aircraft or may get in the airport through a different gate. It must be a bigger problem at international airports and terminals.
If the passenger is caught, what does airport security do, just arrest? What does the airline do if they realise the incident before or after the take-off?
In case there is a jet bridge, of course it's tough to do something like that. I am especially intending the gates that are directly open to outdoor (parking area of the aircrafts). The passengers are expected to walk to the aircraft or are transported by bus depending on the distance between the terminal and the aircraft.