If you are already in Canada on a valid work permit, you can apply to extend it using Form IMM 5710 E - without leaving the country. This applies to both employer-specific (closed) and open work permits.
The most critical rule: apply before your current permit expires. If you apply before the expiry date and IRCC has not yet made a decision, you may be able to continue working under implied status - but only if you meet specific conditions. If your permit expires before you apply, you lose the right to work while your application is being processed.
IRCC processing times for extensions from inside Canada can be significant - often 4–8 months or longer depending on application volume. This is why applying early (ideally 3–4 months before expiry) is strongly recommended.