What should the mass of a planet be in-order for its escape velocity to be near the speed of light?
As @KeithMcClary says in his comment, escape velocity depends on both mass and radius. The smaller the radius for a given mass the higher the escape velocity. So if you could somehow compress the Earth until it was just a few centimeters across, its escape velocity would approach the speed of light.
At the other extreme, if you filled a space twice the diameter of Earth's orbit with copies of the Earth, without doing any compressing at all, it would already be a black hole.
If you just pile matter onto a planet and let its own gravity compress it, you need about 2 solar masses before it is close to being a black hole (at which point it is 10-20 km across).