How to restrict vertex weights to no more than N number of Bones?
In weight paint mode, select the Weight Tools panel in the toolbar, and run Limit Total, This removes vertex groups with lowest weights.

This defaults to 4 which is a common limit for game-engines.

You can also choose which vertex groups are effected when using an armature (Only selected bones for example).

And if you want to only apply this to specific vertices, You can use vertex-select (VKey).