<Page>
                                                                    Exhibit 5.1

                                                                October 20, 2006

Metabolix, Inc.
21 Erie Street
Cambridge, Massachusetts 02139

        Re: SECURITIES BEING REGISTERED UNDER REGISTRATION STATEMENT ON FORM S-1
            --------------------------------------------------------------------

Ladies and Gentlemen:

     This opinion letter is furnished to you in connection with your filing of a
Registration Statement on Form S-1 (File No. 333-135760) (as amended or
supplemented, the "Registration Statement") pursuant to the Securities Act of
1933, as amended (the "Securities Act"), relating to the registration of the
offering by Metabolix, Inc., a Delaware corporation (the "Company"), of up to
6,670,000 shares (the "Shares") of the Company's Common Stock, $0.01 par value
per share, including Shares purchasable by the underwriters upon their exercise
of an over-allotment option granted to the underwriters by the Company. The
Shares are being sold to the several underwriters named in, and pursuant to, an
underwriting agreement among the Company and such underwriters substantially in
the form filed as an Exhibit to the Registration Statement (the "Underwriting
Agreement").

     We have reviewed such documents and made such examination of law as we have
deemed appropriate to give the opinions expressed below. We have relied, without
independent verification, on certificates of public officials and, as to matters
of fact material to the opinions set forth below, on certificates and other
inquiries of officers of the Company.

     The opinion expressed below is limited to the Delaware General Corporation
Law (which includes applicable provisions of the Delaware Constitution and
reported judicial decisions interpreting the Delaware General Corporation Law
and the Delaware Constitution).

     Based on the foregoing, we are of the opinion that the Shares have been
duly authorized and, upon issuance and delivery against payment therefor in
accordance with the terms of the Underwriting Agreement, will be validly issued,
fully paid and non-assessable.

     We hereby consent to the inclusion of this opinion as Exhibit 5.1 to the
Registration Statement and to the references to our firm under the caption
"Legal Matters" in the Registration Statement. In giving our consent, we do not
admit that we are in the category of persons whose consent is required under
Section 7 of the Securities Act or the rules and regulations thereunder.

                                                Very truly yours,

                                                /s/ Goodwin Procter LLP

                                                GOODWIN PROCTER LLP