<PAGE>

                                                                   EXHIBIT 10.40

                          Executive Retention Agreement

      THIS EXECUTIVE RETENTION AGREEMENT by and between PolyMedica Corporation,
a Massachusetts corporation (the "Company"), and Samuel L. Shanaman (the
"Executive") is made as of June 14, 2004 (the "Effective Date").

      WHEREAS, the Company recognizes that, as is the case with many
publicly-held corporations, the possibility of a change in control of the
Company exists and that such possibility, and the uncertainty and questions
which it may raise among key personnel, may result in the departure or
distraction of key personnel to the detriment of the Company and its
stockholders, and

      WHEREAS, the Board of Directors of the Company (the "Board") has
determined that appropriate steps should be taken to reinforce and encourage the
continued employment and dedication of the Company's key personnel without
distraction from the possibility of a change in control of the Company and
related events and circumstances.

      NOW, THEREFORE, as an inducement for and in consideration of the Executive
remaining in its employ, the Company agrees that the Executive shall receive the
following benefits set forth in this Agreement in the event of a Change in
Control (as defined in Section 1.1).

      1. Key Definitions.

      As used herein, the following terms shall have the following respective
meanings:

            1.1 "Change in Control" means an event or occurrence set forth in
any one or more of subsections (a) through (d) below (including an event or
occurrence that constitutes a Change in Control under one of such subsections
but is specifically exempted from another such subsection):

                  (a)   the acquisition by an individual, entity or group
(within the meaning of Section 13(d)(3) or 14(d)(2) of the Securities Exchange
Act of 1934, as amended (the "Exchange Act")) (a "Person") of beneficial
ownership of any capital stock of the Company if, after such acquisition, such
Person beneficially owns (within the meaning of Rule 13d-3 promulgated under the
Exchange Act) in excess of 50% of either (i) the then-outstanding shares of
common stock of the Company (the "Outstanding Company Common Stock") or (ii) the
combined voting power of the then-outstanding securities of the Company entitled
to vote generally in the election of directors (the "Outstanding Company Voting
Securities"); provided, however, that for purposes of this subsection (a), the
following acquisitions shall not constitute a Change in Control: (i) any
acquisition directly from the Company (excluding an acquisition pursuant to the
exercise, conversion or exchange of any security exercisable for, convertible
into or exchangeable for common stock or voting securities of the Company,
unless the Person exercising, converting or exchanging such security acquired
such security directly from the Company or an underwriter or agent of the
Company), (ii) any acquisition by the Company, (iii) any acquisition by any
employee benefit plan (or related trust) sponsored or maintained by the Company
or any corporation controlled by the Company, or (iv) any acquisition by any
corporation pursuant to a transaction which complies with clauses (i) and (ii)
of subsection (c) of this Section 1.1; or

                  (b)   such time as the Continuing Directors (as defined below)
do not constitute a majority of the Board (or, if applicable, the Board of
Directors of a successor corporation to the Company), where the term "Continuing
Director" means at any date a member of the Board (i) who was a member of the
Board on the date of the execution of this Agreement or (ii) who was nominated
or elected subsequent to such date by at least a majority of the directors who
were Continuing Directors at the time of such nomination or election or whose
election to the Board was recommended or endorsed by at least a majority of the
directors who were Continuing Directors at the time of such nomination or
election; provided, however, that there shall be excluded from this clause

                                      -1-
<PAGE>

(ii) any individual whose initial assumption of office occurred as a result of
an actual or threatened election contest with respect to the election or removal
of directors or other actual or threatened solicitation of proxies or consents,
by or on behalf of a person other than the Board; or

                  (c)   the consummation of a merger, consolidation,
reorganization, recapitalization or statutory share exchange involving the
Company or a sale or other disposition of all or substantially all of the assets
of the Company in one or a series of transactions (a "Business Combination"),
unless, immediately following such Business Combination, each of the following
two conditions is satisfied: (i) all or substantially all of the individuals and
entities who were the beneficial owners of the Outstanding Company Common Stock
and Outstanding Company Voting Securities immediately prior to such Business
Combination beneficially own, directly or indirectly, more than 50% of the
then-outstanding shares of common stock and the combined voting power of the
then-outstanding securities entitled to vote generally in the election of
directors, respectively, of the resulting or acquiring corporation in such
Business Combination (which shall include, without limitation, a corporation
which as a result of such transaction owns the Company or substantially all of
the Company's assets either directly or through one or more subsidiaries) (such
resulting or acquiring corporation is referred to herein as the "Acquiring
Corporation") in substantially the same proportions as their ownership,
immediately prior to such Business Combination, of the Outstanding Company
Common Stock and Outstanding Company Voting Securities, respectively; and (ii)
no Person (excluding the Acquiring Corporation or any employee benefit plan (or
related trust) maintained or sponsored by the Company or by the Acquiring
Corporation) beneficially owns, directly or indirectly, 20 % or more of the then
outstanding shares of common stock of the Acquiring Corporation, or of the
combined voting power of the then-outstanding securities of such corporation
entitled to vote generally in the election of directors (except to the extent
that such ownership existed prior to the Business Combination); or

                  (d)   approval by the stockholders of the Company of a
complete liquidation or dissolution of the Company, other than in a bankruptcy
proceeding.

            1.2   "Change in Control Date" means the first date during the Term
(as defined in Section 2) on which a Change in Control occurs.

      2.    Term of Agreement. This Agreement, and all rights and obligations of
the parties hereunder, shall take effect upon the Effective Date and shall
expire upon the expiration of the Term (as defined below) if a Change in Control
has not occurred during the Term. "Term" shall mean the period commencing as of
the Effective Date and continuing through the second anniversary thereof;
provided, however, that commencing on the date prior to the second anniversary
of the Effective Date and each date prior to all subsequent anniversaries of the
Effective Date hereafter, the Term shall be automatically extended for one
additional year unless, not later than 90 days prior to the scheduled expiration
of the Term (or any extension thereof), the Company shall have given the
Executive written notice that the Term will not be extended.

      3.    Employment Status; Not an Employment Contract. The Executive
acknowledges that this Agreement does not constitute a contract of employment or
impose on the Company any obligation to retain the Executive as an employee and
that this Agreement does not prevent the Executive from terminating employment
at any time. If the Executive's employment with the Company terminates for any
reason and subsequently a Change in Control shall occur, the Executive shall not
be entitled to any benefits hereunder.

      4.    Benefits to Executive; Stock Acceleration. If the Change in Control
Date occurs during the Term, then, effective upon the Change in Control Date (a)
each outstanding option to purchase shares of Common Stock of the Company held
by the Executive which are not already fully vested shall become immediately
exercisable in full and will no longer be subject to a right of repurchase by
the Company and (b) each outstanding restricted stock award shall be deemed to
be fully vested and will no longer be subject to a right of repurchase by the
Company.

      5.    Disputes.

                                      -2-
<PAGE>

                  5.1 Settlement of Disputes; Arbitration. All claims by the
Executive for benefits under this Agreement shall be directed to and determined
by the Board of Directors of the Company and shall be in writing. Any denial by
the Board of Directors of a claim for benefits under this Agreement shall be
delivered to the Executive in writing and shall set forth the specific reasons
for the denial and the specific provisions of this Agreement relied upon. The
Board of Directors shall afford a reasonable opportunity to the Executive for a
review of the decision denying a claim. Any further dispute or controversy
arising under or in connection with this Agreement shall be settled exclusively
by arbitration in Boston, Massachusetts, in accordance with the rules of the
American Arbitration Association then in effect. Judgment may be entered on the
arbitrator's award in any court having jurisdiction.

                  5.2 Expenses. The Company agrees to pay as incurred, to the
full extent permitted by law, all legal, accounting and other fees and expenses
which the Executive may reasonably incur as a result of any claim or contest
(regardless of the outcome thereof) by the Company, the Executive or others
regarding the validity or enforceability of, or liability under, any provision
of this Agreement or any guarantee of performance thereof (including as a result
of any contest by the Executive regarding the amount of any payment or benefits
pursuant to this Agreement), plus in each case interest on any delayed payment
at the applicable Federal rate provided for in Section 7872(f)(2)(A) of the
Code.

      6.    Successors.

                  6.1 Successor to Company. The Company shall require any
successor (whether direct or indirect, by purchase, merger, consolidation or
otherwise) to all or substantially all of the business or assets of the Company
expressly to assume and agree to perform this Agreement to the same extent that
the Company would be required to perform it if no such succession had taken
place. Failure of the Company to obtain an assumption of this Agreement at or
prior to the effectiveness of any succession shall be a breach of this Agreement
and shall constitute Good Reason if the Executive elects to terminate
employment, except that for purposes of implementing the foregoing, the date on
which any such succession becomes effective shall be deemed the Date of
Termination. As used in this Agreement, "Company" shall mean the Company as
defined above and any successor to its business or assets as aforesaid which
assumes and agrees to perform this Agreement, by operation of law or otherwise.

                  6.2 Successor to Executive. This Agreement shall inure to the
benefit of and be enforceable by the Executive's personal or legal
representatives, executors, administrators, successors, heirs, distributees,
devisees and legatees. If the Executive should die while any amount would still
be payable to the Executive or his family hereunder if the Executive had
continued to live, all such amounts, unless otherwise provided herein, shall be
paid in accordance with the terms of this Agreement to the executors, personal
representatives or administrators of the Executive's estate.

      7.    Notice. All notices, instructions and other communications given
hereunder or in connection herewith shall be in writing. Any such notice,
instruction or communication shall be sent either (i) by registered or certified
mail, return receipt requested, postage prepaid, or (ii) prepaid via a reputable
nationwide overnight courier service, in each case addressed to the Company, at
11 State St., Woburn, MA 01801, and to the Executive at 5 Millstone Circle,
Andover MA 91819 (or to such other address as either the Company or the
Executive may have furnished to the other in writing in accordance herewith).
Any such notice, instruction or communication shall be deemed to have been
delivered five business days after it is sent by registered or certified mail,
return receipt requested, postage prepaid, or one business day after it is sent
via a reputable nationwide overnight courier service. Either party may give any
notice, instruction or other communication hereunder using any other means, but
no such notice, instruction or other communication shall be deemed to have been
duly delivered unless and until it actually is received by the party for whom it
is intended.

      8.    Miscellaneous.

                  8.1 Severability. The invalidity or unenforceability of any
provision of this Agreement shall not affect the validity or enforceability of
any other provision of this Agreement, which shall remain in full force and
effect.

                                      -3-
<PAGE>

                  8.2 Injunctive Relief. The Company and the Executive agree
that any breach of this Agreement by the Company is likely to cause the
Executive substantial and irrevocable damage and therefore, in the event of any
such breach, in addition to such other remedies which may be available, the
Executive shall have the right to specific performance and injunctive relief.

                  8.3 Governing Law. The validity, interpretation, construction
and performance of this Agreement shall be governed by the internal laws of the
Commonwealth of Massachusetts, without regard to conflicts of law principles.

                  8.4 Waivers. No waiver by the Executive at any time of any
breach of, or compliance with, any provision of this Agreement to be performed
by the Company shall be deemed a waiver of that or any other provision at any
subsequent time.

                  8.5 Counterparts. This Agreement may be executed in
counterparts, each of which shall be deemed to be an original but both of which
together shall constitute one and the same instrument.

                  8.6 Entire Agreement. This Agreement sets forth the entire
agreement of the parties hereto in respect of the subject matter contained
herein and supersedes all prior agreements, promises, covenants, arrangements,
communications, representations or warranties, whether oral or written, by any
officer, employee or representative of any party hereto in respect of the
subject matter contained herein; and any prior agreement of the parties hereto
in respect of the subject matter contained herein is hereby terminated and
cancelled.

                  8.7 Amendments. This Agreement may be amended or modified only
by a written instrument executed by both the Company and the Executive.

      IN WITNESS WHEREOF, the parties hereto have executed this Executive
      Retention Agreement as of the day and year first set forth above.

                                      POLYMEDICA CORPORATION

                                      Sincerely,

                                      /s/ Marcia J. Hooper
                                      ------------------------------------------
                                      Marcia J. Hooper
                                      Compensation Committee
                                      Board of Directors, PolyMedica Corporation

ACCEPTED AND AGREED TO:

/s/ Samuel L. Shanaman
-------------------------
Samuel L. Shanaman

                                      -4-