<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0206</schemaVersion>

    <documentType>3</documentType>

    <periodOfReport>2016-03-30</periodOfReport>

    <noSecuritiesOwned>0</noSecuritiesOwned>

    <issuer>
        <issuerCik>0001597313</issuerCik>
        <issuerName>ViewRay, Inc.</issuerName>
        <issuerTradingSymbol>VRAY</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001531332</rptOwnerCik>
            <rptOwnerName>Gold Mark Stephen</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O VIEWRAY, INC.</rptOwnerStreet1>
            <rptOwnerStreet2>2 THERMO FISHER WAY</rptOwnerStreet2>
            <rptOwnerCity>OAKWOOD VILLAGE</rptOwnerCity>
            <rptOwnerState>OH</rptOwnerState>
            <rptOwnerZipCode>44146</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>0</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle></officerTitle>
            <otherText></otherText>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>3206</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>98966</value>
                    <footnoteId id="F1"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>See footnote</value>
                    <footnoteId id="F1"/>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeHolding>
            <securityTitle>
                <value>Stock Option (right to buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>.8</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F2"/>
            </exerciseDate>
            <expirationDate>
                <value>2018-12-08</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>4513</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Stock Option (right to buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>.68</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F3"/>
            </exerciseDate>
            <expirationDate>
                <value>2010-06-29</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>4673</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Stock Option (right to buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>.68</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F4"/>
            </exerciseDate>
            <expirationDate>
                <value>2020-06-29</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>3703</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Stock Option (right to buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>.70</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F5"/>
            </exerciseDate>
            <expirationDate>
                <value>2022-03-01</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>2436</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Stock Option (right to buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>.75</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F6"/>
            </exerciseDate>
            <expirationDate>
                <value>2024-04-11</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>3703</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Stock Option (right to buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>.75</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F7"/>
            </exerciseDate>
            <expirationDate>
                <value>2024-04-11</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>1032</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Stock Option (right to buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>5</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F8"/>
            </exerciseDate>
            <expirationDate>
                <value>2025-07-23</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>19556</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">54,129 shares held by MJSK, Ltd. and 44,837 shares are held by JMSK, Ltd. Janice Gold, the wife of Dr. Gold, is the President of MJSK, Ltd., and Steven Gold, the son of Dr. Gold, is the General Partner of JMSK, Ltd. Voting and dispositive decisions with respect to shares held by MJSK, Ltd. and JMSK, Ltd. are not made by Dr. Gold; he disclaims beneficial ownership of the shares held by MJSK, Ltd. and JMSK, Ltd. except to the extent of any pecuniary interest therein, if any.</footnote>
        <footnote id="F2">One-third (1/3) of the shares subject to the option vest beginning on December 3, 2009, until such shares subject to the option have become fully vested and exercisable.</footnote>
        <footnote id="F3">The shares subject to the option vest in 48 monthly installments beginning on July 14, 2010, until such shares subject to the option have become fully vested and exercisable.</footnote>
        <footnote id="F4">The shares subject to the option vest in 36 monthly installments beginning on June 17, 2010, until such shares subject to the option have become fully vested and exercisable.</footnote>
        <footnote id="F5">The shares subject to the option vest in 48 monthly installments on each monthly anniversary of March 1, 2012, until such shares subject to the option have become fully vested and exercisable.</footnote>
        <footnote id="F6">The shares subject to the option vest in 48 monthly installments on the first calendar day of each month following May 13, 2013, until such shares subject to the option have become fully vested and exercisable.</footnote>
        <footnote id="F7">The shares subject to the option vest in 48 monthly installments on the first calendar day of each month following November 13, 2013, until such shares subject to the option have become fully vested and exercisable.</footnote>
        <footnote id="F8">The shares subject to the option vest in 12 monthly installments on each monthly anniversary of July 23, 2015, until such shares subject to the option have become fully vested and exercisable.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Wesley Mintu, Wesley Mintu, as Attorney-in-Fact for Mark S. Gold</signatureName>
        <signatureDate>2016-03-30</signatureDate>
    </ownerSignature>
</ownershipDocument>
