warframes and weapons only go to a max rank of 30, a few select weapons can go to 40. However, it is the mods and builds you use which allow you to take on high level enemies
Weapon level and enemy level are not linked. And Warframes, Companions, Archwings, and most weapons are capped at Rank 30, though some do reach R40 ( Kuva Shildeg and Paracesis for example). Leveling equipment does not make it more powerful either, it just allows you to apply stronger mods or more mods.
If you don't have the capacity for better mod builds, even at max rank, then you should apply an Orokin Catalyst if you have not done so already. This will double your current mod capacity. If even after that your build still can't fit then apply a Forma. This will reset your weapon back to R0, meaning you'll have to re-level it, but you will gain a polarity of your choice. Matching a mod with the polarity of the slot will halve its capacity cost.
oh ok, so the better mods i have equipped the more powerful the weapons and warframe becomes
remember, it is preferable to use reactors/catalysts and forma on gear that can make the investment worthwhile, not every peice of item that you get. It would allow for you to focus on making the better weapons shine and less time wasted trying to make everything good