<PAGE>

                                                                    EXHIBIT 10.7

June 29, 2004

Michael Gray
11992 Brookridge Drive
Saratoga, CA  95070

                      RE: Settlement and Release Agreement

Dear Michael:

            This letter confirms the terms of our agreement regarding the
termination of your employment with SanDisk Corporation. ("SanDisk" or the
"Company"). We agree that your employment with the Company will terminate on
October 4, 2004 (such termination date referred to in this letter as your
"Termination Date"). Commencing on June 21, 2004 and continuing through your
Termination Date, you will report to Eli Harari on a regular part-time basis (of
at least 20 hours per week) as Senior Vice President and your job will be to
assist Ms. Bruner with transitional duties as reasonably requested by the
Company and such other duties as we may agree upon with you. You will be
provided with an office, computer, cell phone and other normal office tools
through your Termination Date.

            On your Termination Date, you will be paid your accrued but unused
vacation pay as well as your pay through the Termination Date, less applicable
deductions and withholdings. On the eighth day following our receipt of your
signed Supplement to General Release (to be signed by you in the form attached
as Exhibit A on or after your Termination Date, but not later than 30 days
following your Termination Date), the Company will provide you with the
following benefits. On such eighth day, the Company will pay you a lump sum,
representing your base salary, less applicable deductions and withholdings, with
no accrual of vacation pay, covering the period October 5, 2004 through December
31, 2004. The Company also agrees to pay your COBRA premium through October 31,
2005, or until you commence full-time employment or commence a full-time
consulting arrangement with another entity, company or individual that provides
regular medical benefits, whichever occurs first. You are obligated to notify
the Company within five days of commencing such an employment or consulting
arrangement. As used herein, full-time employment or full-time consulting shall
mean at least 40 hours of service per week. Your access to company email and
voicemail will terminate on the Termination Date. Your rights to all Company
benefits, other than our payment of your COBRA premium as specified above,

<PAGE>

Michael Gray
June 29, 2004
Page 2

including without limitation, life insurance, 401K participation (however, you
may continue to keep your 401k funds at SanDisk without further contribution on
your part in accordance with the rules of the Company, as may be amended from
time to time), ESPP participation, disability insurance and bonus pay for 2004
shall cease as of the Termination Date. You agree you will not receive bonus pay
for 2004.

            Your outstanding stock options will continue to vest on their
regularly scheduled vesting dates through and until your Termination Date.
Attached as Exhibit B is a chart which identifies each of your outstanding
option grants, the shares that are currently exercisable, the expiration date of
each option, and your last date to exercise assuming an October 4, 2004
Termination Date. Exhibit B also shows the number of additional shares that will
vest under each of your outstanding stock options from the date you sign this
Agreement through October 4, 2004 pursuant to the current vesting schedule in
effect for each such option. The shares set out in Exhibit B will be exercisable
by you according to the terms of your existing stock option agreements and the
plan. All shares that are currently exercisable under these options or that will
vest prior to your Termination Date will remain exercisable only through the end
of the applicable exercise period following your Termination Date, and no
additional shares under your options will vest following your Termination Date.
The applicable exercise period following your Termination Date will be two (2)
months for any options granted to you before June 20, 2001 and will be three (3)
months for any options granted to you on or after June 20, 2001.

            To the extent your options are incentive stock options (ISOs) under
the federal tax laws, you will recognize immediate taxable income, for
alternative minimum tax purposes, upon exercise in an amount equal to the fair
market value of the shares purchased under those options less the exercise price
paid for those shares, and you may thereby incur alternative minimum tax
liability for the year or years in which you exercise those ISOs.

            To the extent any of those options are non-statutory or
non-qualified stock options (NQSOs) under the federal tax laws, you will
recognize immediate taxable income upon exercise in an amount equal to the fair
market value of the shares purchased under those NQSOs less the exercise price
paid for those shares. This income will be taxable as wages, whether or not you
are a Company employee at the time of exercise. Accordingly, you must, at the
time of exercise, pay the Company not only the exercise price for the purchased
shares but also all applicable federal, state and local income and employment
withholding taxes.

            You agree to return to the Company all Company property and
documents in your possession on or before the Termination Date, including
without limitation, your computer, cell phone and files. If you like, the
Company will discuss selling your

<PAGE>

Michael Gray
June 29, 2004
Page 3

existing laptop to you, once data files have been removed. You also understand
and agree that you may not utilize any proprietary information, confidential
information and/or trade secrets of the Company, other than for the purposes of
the Company, at any time in the future and you will comply with any and all
other obligations you may have regarding the Company's proprietary,
confidential, and/or trade secret information. Specifically, you agree that you
will continue to be bound to the terms of the Company's Proprietary Information
and Inventions Agreement, a copy of which is attached as Exhibit C.

            In exchange for the promises and covenants herein and payment of
severance and receipt of the other benefits described above and subject to the
paragraph below, "Duty to Indemnify", you hereby forever fully release SanDisk
and any and all of its respective predecessors, successors, subsidiaries,
officers, directors, agents, attorneys, employees and assigns (hereafter
collectively referred to as "Releasees"), and covenant not to sue or otherwise
institute or cause to be instituted or in any way participate in (except at the
request of SanDisk or to the extent required by a legal process not initiated by
you) legal or administrative proceedings against Releasees with respect to any
matter arising out of or connected with your relationship with SanDisk or the
termination of that relationship from the beginning of time to the present,
including any and all liabilities, claims, demands, contracts, debts,
obligations and causes of action of every nature, kind and description, in law,
equity, or otherwise, whether or not now known or ascertained, which heretofore
do or may exist. You agree that on your Termination Date you will execute the
Supplement to General Release, attached as Exhibit A and deliver it to the
office of the Company's Vice President and General Counsel.

            You further agree that you are waiving any rights you may have had
or now have, to pursue any and all remedies available to you against Releasees,
including without limitation, breach of contract, fraud, stock fraud, claims of
wrongful discharge, emotional distress, defamation, breach of the covenant of
good faith and fair dealing, violation of the provisions of the California Labor
Code, the Employee Retirement Income Security Act, and any other laws and
regulations relating to employment. You further acknowledge and expressly agree
that you are waiving any and all rights you may have had or now have to pursue
any claim of discrimination, including but not limited to, any claim of
discrimination or harassment based on sex, age, race, national origin,
disability or on any other basis, under Title VII of the Civil Rights Act of
1964, as amended, the California Fair Employment and Housing Act, Worker
Adjustment and Retraining Notification Act of 1988, the California Constitution,
the Equal Pay Act of 1963, and all other laws and regulations relating to
employment. You further agree that you are not and will not be entitled to any
benefits under any severance plan that the Company has or may adopt in the
future.

<PAGE>

Michael Gray
June 29, 2004
Page 4

            Finally, you agree that this letter agreement extends to all claims
of every nature and kind, known or unknown, suspected or unsuspected, past or
present, and that any and all rights granted to you under Section 1542 of the
California Civil Code or any analogous state law or federal law or regulation
are hereby expressly waived. Section 1542 of the California Civil Code reads as
follows:

            A general release does not extend to claims which the creditor does
            not know or suspect to exist in his favor at the time of executing
            the release, which, if known by him, must have materially affected
            his settlement with the debtor.

            This Agreement shall be entered into in the State of California and
shall be construed and interpreted in accordance with the laws of the State of
California, excluding any conflicts or choice of law rule or principle that
might otherwise refer construction or interpretation of this Agreement to the
substantive laws of another jurisdiction.

            You agree that you will not, without compulsion of legal process,
disclose to others the terms of this Agreement, except that you may disclose
them to your attorneys, accountants or other professional advisors to whom
disclosure is necessary to effect the purposes for which you have consulted such
professional advisors.

            Any controversy involving the construction or application of any
terms, covenants or conditions of this Agreement, or any claims arising out of
or relating to this Agreement or the breach thereof will be submitted to and
settled by final and binding arbitration in Santa Clara County, California in
accordance with the rules of the American Arbitration Association under its
California Employment Dispute Resolution Rules then in effect or by rules
mutually agreed upon in writing by the parties. The parties further understand
and agree that the arbitration shall be instead of any civil litigation and that
the arbitrator's decision shall be final and binding to the fullest extent
permitted by law and enforceable by any court having jurisdiction thereof.
Unless the law provides otherwise, each party will be responsible for its own
attorney fees in connection with the arbitration proceeding.

            Duty to Indemnify. The releases set forth above shall not release
the Company from its obligation to indemnify Mr. Gray against any claims which
are brought in accordance with and subject to the terms of (i) that certain
"Indemnification Agreement" entered into between the Company and Mr. Gray on
October 23, 2003, or (ii) the Bylaws of the Company.

<PAGE>

Michael Gray
June 29, 2004
Page 5

            You understand and agree that you:

            A.    Have had a full twenty-one (21) days (or have voluntarily
                  chosen a shorter period of time, upon advice of your counsel)
                  within which to consider this Agreement before executing it;

            B.    Have carefully read and fully understand all of the provisions
                  of this Agreement;

            C.    Are, through this Agreement, releasing SanDisk from any and
                  all claims that you may have against SanDisk;

            D.    Are knowingly and voluntarily agreeing to all of the terms set
                  forth in this Agreement;

            E.    Were advised to consider the terms of this Agreement and
                  consult with an attorney of your choice prior to executing
                  this agreement. You will be responsible for any attorneys fees
                  incurred by you in connection with reviewing this Agreement
                  with an attorney of your choosing;

            F.    Have a full seven (7) days following the execution of this
                  Agreement to revoke this Agreement and have been and hereby
                  are advised in writing that this Agreement shall not become
                  effective or enforceable until the revocation period has
                  expired (the "Effective Date"). Said revocation shall be in
                  writing and shall be sent by certified mail, return receipt
                  requested, to me;

            G.    Understand that any rights or claims under the Age
                  Discrimination in Employment Act of 1967 (29 U.S.C. Section
                  621 et seq.) that may arise after the date this Agreement is
                  executed are not waived; and

            H.    Are, by reason of this Agreement and the release of claims
                  herein, receiving from SanDisk consideration in addition to
                  anything of value to which you were already entitled.

            This Agreement can only be modified by a written document signed by
you and by an authorized officer of the Company.

<PAGE>

Michael Gray
June 29, 2004
Page 6

            Please indicate your agreement with the above terms by signing
below.

                                          Sincerely,

                                          SANDISK CORPORATION

                                          By: /s/ Charles Van Orden
                                              -------------------------
                                              Charles Van Orden
                                              Vice President and General Counsel

            My agreement with the above terms is signified by my signature
below. I acknowledge that I have read and understand this letter and that I sign
with full appreciation that at no time in the future may I pursue any of the
rights I have waived pursuant to the release provisions of this agreement
herein.

Dated: June 29, 2004.                                   /s/ Michael Gray
                                                --------------------------------
                                                          Michael Gray

<PAGE>

                                    EXHIBIT A

                          SUPPLEMENT TO GENERAL RELEASE

            I, Michael Gray, hereby affirm that, by signing below:

            1.    I intend that the releases and waivers contained in the letter
agreement between me and SanDisk Corporation dated June 29, 2004, shall be and
are effective as of and through the effective date of this Supplement to General
Release and for the rest of time.

            2.    I understand and agree that for the period of seven (7) days
after I sign this Supplement to General Release, I may revoke it by delivering a
written notice of my revocation to the office of the Vice President and General
Counsel of the Company.

            3.    This Supplement to General Release shall become effective on
the eighth day after I signed it provided that I have delivered it to the office
of the Vice President and General Counsel of the Company and have not revoked it
during the seven days after I have signed it.

Date: 10/4/04                                      /s/ Michael Gray
      -------------------                          ---------------------
                                                   Michael Gray