<DOCUMENT>
<TYPE>EX-5.1
<SEQUENCE>2
<FILENAME>y49978ex5-1.txt
<DESCRIPTION>OPINION OF WILLIAM G. VON GLAHN, ESQ.
<TEXT>

<PAGE>   1

                                                                     EXHIBIT 5.1

                   [THE WILLIAMS COMPANIES, INC. LETTERHEAD]

                                                                   June 15, 2001

The Williams Companies, Inc.
One Williams Center
Tulsa, Oklahoma 74172

Ladies and Gentlemen:

     Re: The Williams Companies, Inc. Common Stock issuable in the Barrett
Resources Corporation Merger

     I am Senior Vice President and General Counsel of The Williams Companies,
Inc., a Delaware corporation (the "Company"), and I, or attorneys responsible to
me, have acted as counsel for the Company in connection with the preparation of
a Registration Statement on Form S-4 (the "Registration Statement") to be filed
by the Company with the Securities and Exchange Commission (the "Commission")
under the Securities Act of 1933, as amended (the "Securities Act"). The
Registration Statement relates to the registration under the Securities Act of
the offer and sale of shares of the Company's common stock, par value $0.01 per
share (including the associated preferred stock purchase rights, the "Shares"),
that may be issued in exchange for shares of common stock, par value $0.01 per
share, of Barrett Resources Corporation ("Barrett Resources"). Such issuance and
exchange would occur in connection with the merger (the "Merger") of Barrett
Resources with the Company's wholly-owned subsidiary Resources Acquisition Corp.
as described in the Agreement and Plan of Merger, dated as of May 7, 2001 (the
"Merger Agreement"), among the Company, Barrett Resources and Resources
Acquisition Corp.

     This opinion is being furnished in accordance with the requirements of Item
601(b)(5) of Regulation S-K under the Securities Act. Capitalized terms used but
not otherwise defined herein have the meanings ascribed to them in the
Registration Statement.

     In connection with this opinion, I, or persons responsible to me, have
examined originals or copies, certified or otherwise identified to my
satisfaction, of (i) the Restated Certificate of Incorporation and By-laws of
the Company, each as amended to date, (ii) the Registration Statement, as
amended through the date hereof, (iii) a specimen certificate evidencing the
Company's common stock, and (iv) certain resolutions adopted to date by the
Board of Directors of the Company. I, or persons responsible to me, have also
examined originals or copies, certified or otherwise identified to my
satisfaction, of such records of the Company and such agreements, certificates
or records of public officials, certificates of officers or representatives of
the Company and others, and such other documents, certificates and records as I
have deemed necessary or appropriate as a basis for the opinions set forth
herein.

     In my examination, I have assumed the legal capacity of all natural
persons, the genuineness of all signatures, the authenticity of all documents
submitted to me as originals, the conformity to original documents of all
documents submitted to me as certified or photostatic copies and the
authenticity of the originals of such copies. In making my examination of
documents executed by parties other than the Company, I have assumed that such
parties had or will have the power, corporate or other, to enter into and
perform all obligations thereunder and have also assumed the due authorization
by all requisite action, corporate or other, and execution and delivery by such
parties of such documents and that such documents constitute valid and binding
obligations of such parties. As to any facts material to this opinion that I did
not independently establish or verify, I have relied upon oral or written
statements or representations of officers and other representatives of the
Company and Barrett Resources.

     I am a member of the bars of the states of Oklahoma and New York. The
opinions expressed herein are based upon and limited exclusively to the General
Corporation Law of the State of Delaware.
<PAGE>   2

     Based upon and subject to the foregoing and to the limitations,
qualifications, exceptions and assumptions set forth herein, I am of the opinion
that the Shares which are being registered pursuant to the Registration
Statement have been duly authorized by the Company, and when issued in the
manner contemplated by the Registration Statement and in accordance with the
terms of the Merger Agreement, the Shares will be validly issued, fully paid and
nonassessable.

     I hereby consent to the filing of this opinion with the Commission as
Exhibit 5.1 to the Registration Statement. I also consent to the use of my name
under the heading "Legal Matters" in the Registration Statement.

                                          Sincerely,

                                          /s/      WILLIAM VON GLAHN
                                          --------------------------------------
                                          William von Glahn
                                          Senior Vice President &
                                          General Counsel
                                          The Williams Companies, Inc.
</TEXT>
</DOCUMENT>
