<PAGE>

                                                                Exhibit 10.5

                        KOSAN BIOSCIENCES INCORPORATED
                                1450 ROLLINS ROAD
                              BURLINGAME, CA 94010


                    AMENDED AND RESTATED CONSULTING AGREEMENT



Chaitan Khosla                                                 December 7, 1998
740 La Para Avenue
Palo Alto, CA 94306

Dear Chaitan:

Kosan Biosciences Incorporated ("Kosan") desires to amend and restate the
Amended and Restated Consulting Agreement dated March 29, 1996 between you
and Kosan concerning its engagement of you as a consultant and advisor for
its scientific and business activities as follows:

1.   You are the founder of Kosan and have served as a director of and as a
     consultant of Kosan since its inception. During the term of this
     Agreement Kosan will continue to retain you as a consultant, and, so
     long as you so desire, will use its best efforts to cause you to be
     elected to the Board of Directors of Kosan at each time directors are
     elected. In addition to your services to Kosan as a director, you will
     consult with officers, directors, employees and consultants of Kosan
     regarding Kosan's scientific and business affairs. You will devote such
     time to the affairs of Kosan, not to exceed one day per week, reasonably
     necessary to fulfill your duties to Kosan.

2.   Kosan has granted you an option to purchase 65,000 shares of its
     Common Stock at a purchase price of $1.00 per share with vesting
     commencing January 1, 1999 and continuing over a four year period.

3.   Commencing January 1, 1999, you will receive compensation for your
     services at a mutually agreed upon rate, but not less than $100,000 per
     year, payable monthly on the regular paydays of Kosan. In determining
     your rate of compensation, Kosan will take into account, among other
     relevant factors the time you have devoted and will devote in the future
     to the funding of Kosan, including the establishment of strategic
     relationships, and the value you have brought to Kosan through such
     funding and strategic relationships. In addition, you will be eligible to
     receive bonus compensation in the discretion of the Board of Directors.
     Annual bonuses would normally be expected if Kosan is performing
     substantially in accordance with its operating plan. At any time during
     the term of this letter agreement you may, at your

<PAGE>

Consulting Agreement
Chaitan Khosla
December 7, 1998
Page #2

     option, become an employee of Kosan.  If you become a full time employee
     of Kosan, you shall be appointed to a senior executive position of Kosan
     as determined by the Board of Directors and your salary and bonus shall
     be commensurate with that position.  You will be entitled to
     reimbursement of expenses incurred by you in connection with the
     services you render to Kosan in accordance with Kosan' expense
     reimbursement policies.

4.   You agree that after February 26, 1996 any inventions, innovations,
     suggestions, ideas and reports made by you which are directly related to
     Kosan' business and result from services performed by you under this
     letter agreement or any prior consulting agreement between you and Kosan
     shall be promptly disclosed to Kosan and shall become the sole property of
     Kosan.  Any patent applications or patents relating to the foregoing, and
     all rights pertaining thereto, are hereby assigned to Kosan.  Appendix A
     describes items specifically excluded from this agreement.

     Kosan is aware that you are subject to the Patent Policy of the Stanford
     University which requires you to disclose to it any inventions made by
     you during your employment with the University.  Kosan agrees that
     nothing contained in this agreement shall place you in conflict with
     your obligations under the University's Patent Policy.  Kosan agrees,
     and you agree as well, to work cooperatively with the University to
     resolve any potential conflicts over rights to inventions and your
     obligations under the University's Patent Policy.

5.   You agree that during the term of this Agreement and any subsequent
     extensions, and for a period of three years thereafter, you will not
     disclose or use, without prior written consent of Kosan, any Kosan
     confidential information. "Confidential information" in this context
     means all data, information, technology, or trade secrets (including all
     cell cultures, chemical materials or biological materials derived
     therefrom) relating to Kosan' technical programs or business plans,
     which you know or have reason to know is regarded as confidential by
     Kosan.

     This agreement does not apply to confidential information that (i) has
     become part of the public domain except by breadth of this agreement,
     (ii) that Kosan patented, published or otherwise disclosed, (iii) that
     you knew prior to its disclosure to you by Kosan, or (iv) that you
     learned from a source having no duty to Kosan.

6.   You further agree that during the terms of this Agreement you will not
     disclose to Kosan any proprietary information, such as trade secrets,
     which is confidential to any third party or institution.

7.   You agree that as a consultant you are not an employee of Kosan, but are
     instead, an independent contractor.

<PAGE>

Consulting Agreement
Chaitan Khosla
December 7, 1998
Page #3

8.   You warrant that you are permitted to enter into this Agreement and that
     the terms are not inconsistent with present employment or other
     contractual agreements.

9.   The term of this Agreement shall begin on the date hereof and shall
     continue through February 28, 2000, unless earlier terminated.  The term
     of this agreement shall be automatically extended for an additional two
     year term unless either party gives written notice to the other to the
     contrary on or before November 30, 1999.  Either party may terminate
     this letter agreement prior to the end of the initial term (or extended
     term, as applicable) upon thirty (30) days prior written notice to the
     other party.  This letter agreement will terminate in the event of your
     death or permanent disability.  Your permanent disability means your
     inability to perform any services for Kosan (including services
     performed away from the company's facilities) for a continuous period in
     excess of six months.

10.  In the event that:

     (A)(i) Kosan enters a merger or other reorganization (as defined in
     Section 181 of the California Corporations Code) with or into another
     corporation or entity (except where California Corporations Code Section
     1201(b) does not require the approval of the outstanding shares of Kosan
     with respect to such merger or other reorganization), (ii) Kosan sells
     all or substantially all of its assets, (iii) a person or entity makes a
     tender or exchange offer for and acquires 50% or more of the issued and
     outstanding voting securities of Kosan, or (iv) any person within the
     meaning of Section 3(a)(9) or Section 13(d)(3) of the Securities
     Exchange Act of 1934, as amended, acquires more than 50% of Kosan's
     issued and outstanding voting securities of Kosan, or

     (B)(i) you are not elected to the Board of Directors so long as you
     desire, (ii) Kosan is in material breach of the terms of this letter
     agreement and has not cured this breach within thirty days, or (iii)
     Kosan is bankrupt or insolvent, or

     (C) Kosan terminates this letter agreement without cause,

     then (1) Kosan will pay you the greater of (x) any remaining
     compensation payable during the initial term (or extended term, as
     applicable), or (y) an amount equal to two times your current annual
     compensation for the current year (the "Severance Payment") and (2) all
     of your stock options, stock awards and similar equity rights will
     immediately vest fully and become exercisable.  Kosan will also be
     obligated to make the Severance Payment if you die or become permanently
     disabled and Kosan has not provided both life and disability insurance to
     you in the amount of $1,000,000.  As used in this letter agreement,
     "cause" shall

<PAGE>

Consulting Agreement
Chaitan Khosla
December 7, 1998
Page #4

     mean (i) any material breach of this letter agreement by you which is
     not cured within thirty days after notice of breach is provided to you by
     the Company, (ii) your conviction of a felony, or (iii) any action by
     you which in the reasonable judgment of Kosan constitutes dishonesty,
     larceny, fraud, deceit or gross negligence by you in the performance of
     your duties to Kosan or willful misrepresentation to shareholders,
     directors or officers of Kosan.

If you are in agreement with the foregoing terms and conditions, please sign
and date both original copies of this letter and return one to Kosan.

Sincerely,

/s/ Daniel V. Santi

Kosan Biosciences Incorporated
Daniel V. Santi
President


AGREED
------

NAME: CHAITAN KHOSLA
      --------------

DATE: December 7, 1998
      ----------------

<PAGE>

                                     APPENDIX A

     This Consulting Agreement between Kosan and Chaitan Khosla excludes the
following U.S. patents:

     1.   "Enhancement of Cell Growth by Expression of a Cloned Hemoglobin
          Gene," filed in 1991 and owned by California Institute of
          Technology; and

     2.   "A Method of Generating Multiple Protein Variance and Populations
          of Protein Variance Prepared Thereby," filed in 1995 and owned by
          Stanford University.